3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test; class Foo { public function bar(callable $a) { $a(); } public function hello() { echo 'World' . PHP_EOL; } } $foo = new Foo(); echo is_callable(array($foo, 'hello')) . PHP_EOL; $foo->bar(array($foo, 'hello'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16LXZ
function name:  (null)
number of ops:  17
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Test%5CFoo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   19     3        INIT_NS_FCALL_BY_NAME                                    'Test%5Cis_callable'
          4        INIT_ARRAY                                       ~4      !0
          5        ADD_ARRAY_ELEMENT                                ~4      'hello'
          6        SEND_VAL_EX                                              ~4
          7        DO_FCALL                                      0  $5      
          8        FETCH_CONSTANT                                   ~6      'Test%5CPHP_EOL'
          9        CONCAT                                           ~7      $5, ~6
         10        ECHO                                                     ~7
   20    11        INIT_METHOD_CALL                                         !0, 'bar'
         12        INIT_ARRAY                                       ~8      !0
         13        ADD_ARRAY_ELEMENT                                ~8      'hello'
         14        SEND_VAL_EX                                              ~8
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Class Test\Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16LXZ
function name:  bar
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_DYNAMIC_CALL                                        !0
          2        DO_FCALL                                      0          
   10     3      > RETURN                                                   null

End of function bar

Function hello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/16LXZ
function name:  hello
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_CONSTANT                                   ~0      'Test%5CPHP_EOL'
          1        CONCAT                                           ~1      'World', ~0
          2        ECHO                                                     ~1
   15     3      > RETURN                                                   null

End of function hello

End of class Test\Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.39 ms | 1388 KiB | 15 Q