在以下示例代码,该方法test()在父类Foo是由该方法覆盖test()在子类Bar.是否有可能调用Foo::test()从Bar::test()?
class Foo
{
$text = "world\n";
protected function test() {
echo $this->text;
}
}// class Foo
class Bar extends Foo
{
public function test() {
echo "Hello, ";
// Cannot use 'parent::test()' because, in this case,
// Foo::test() requires object data from $this
parent::test();
}
}// class Bar extends Foo
$x = new Bar;
$x->test();
Run Code Online (Sandbox Code Playgroud) 我的脚本比较了两个源树,创建了可能更改的文件的映射,比较了MD5哈希并创建了一个diff-package.
在28000-29000个文件之后,PHP终止了脚本并出现错误:
致命错误:第67行的/root/_PACKER-TESTER/core/diff.class.php超出了0秒的最大执行时间(标准的in_array()调用)
我已经尝试设置max_input_time为高值(或零) - 没有.
设置max_execution_time为99999999999999不执行任何操作....相同的错误.
我阅读了很多php联机帮助页,但只在上下文中找到了有关SNI支持的信息 - http://www.php.net/manual/en/context.ssl.php
当PHP作为服务器工作时,是否可以通过浏览器获取SNI?使用标准stream_socket_server()创建服务器,如例如.这篇文章:http://www.php.net/manual/en/function.stream-socket-server.php#98616
我在 C 中发现了一种奇怪的(对我来说)行为。int如果这是一个基本问题,请注意,但我无法找到为什么以下代码会产生意外结果的答案。
#include <stdio.h>
int main(void)
{
printf("1000 * 0.1 = %d\n", (1000 * 0.1));
printf("1000 * (10/100) = %d\n", (1000 * (10/100)));
printf("(int)1000 * 0.1 = %d\n", (int)(1000 * 0.1));
printf("(int)1000 * (10/100) = %d\n", (int)(1000 * (10/100)));
return 0;
}
Run Code Online (Sandbox Code Playgroud)
两者的结果是-O0相同-O3的:
1000 * 0.1 = -957043896
1000 * (10/100) = 0
(int)1000 * 0.1 = 100
(int)1000 * (10/100) = 0
Run Code Online (Sandbox Code Playgroud)
我预计前两个结果是无意义的(我不知道为什么,但我预计将 double 传递给 int 参数不应该起作用)。然而3和4之间的差异让我感到困惑。我期望(10/100)在编译时计算并呈现与 3 …
c floating-point printf integer-arithmetic conversion-specifier
<?php
abstract class foo {
function foof() {
echo "Hello, I'm foo :)";
}
}
class foo2 extends foo {
function foo2f() {
$this->foof();
}
}
class foo3 extends foo2 {
function foo3f() {
$this->foo2f();
}
}
$x = new foo3;
$x->foo3f();
?>
Run Code Online (Sandbox Code Playgroud)
这段代码输出"Hello,I'm foo :)"(正如预期的那样),但当我将代码改为这样的代码时:http://pastebin.com/wNeyikpq
<?php
abstract class foo {
function fooing() {
echo "Hello, I'm foo :)";
}
}
class foo2 extends foo {
function foo2() {
$this->fooing();
}
}
class foo3 extends …Run Code Online (Sandbox Code Playgroud) php ×4
c ×1
constructor ×1
https ×1
litespeed ×1
object ×1
overriding ×1
php-openssl ×1
php4 ×1
printf ×1
ssl ×1