コード例 #1
0
 public static function invoke(Foo $instance)
 {
     // Same class, other instance, direct call.
     $instance->call();
     // Same class, other instance, indirect call.
     $foo = new Foo();
     $foo->call();
     // Same class, other instance, indirect call.
     $x = new Foo();
     $y = $x;
     $z = $y;
     $z->call();
     // Same class, other instance, direct call.
     (new Foo())->call();
     // Other class, other instance, indirect call.
     $bar = new Bar();
     $bar->call();
     // Other class, other instance, direct call.
     (new Bar())->call();
 }
コード例 #2
0
ファイル: micro_bench.php プロジェクト: cefalo19/php-src
$t = end_test($t, '$this->x = 0', $overhead);
$x->assign_add_prop(N);
$t = end_test($t, '$this->x += 2', $overhead);
$x->pre_inc_prop(N);
$t = end_test($t, '++$this->x', $overhead);
$x->pre_dec_prop(N);
$t = end_test($t, '--$this->x', $overhead);
$x->post_inc_prop(N);
$t = end_test($t, '$this->x++', $overhead);
$x->post_dec_prop(N);
$t = end_test($t, '$this->x--', $overhead);
$x->isset_prop(N);
$t = end_test($t, 'isset($this->x)', $overhead);
$x->empty_prop(N);
$t = end_test($t, 'empty($this->x)', $overhead);
$x->call(N);
$t = end_test($t, '$this->f()', $overhead);
$x->read_const(N);
$t = end_test($t, '$x = Foo::TEST', $overhead);
create_object(N);
$t = end_test($t, 'new Foo()', $overhead);
read_const(N);
$t = end_test($t, '$x = TEST', $overhead);
read_auto_global(N);
$t = end_test($t, '$x = $_GET', $overhead);
read_global_var(N);
$t = end_test($t, '$x = $GLOBALS[\'v\']', $overhead);
read_hash(N);
$t = end_test($t, '$x = $hash[\'v\']', $overhead);
read_str_offset(N);
$t = end_test($t, '$x = $str[0]', $overhead);