3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Test; class A { public function b(callable $b) { $b(); } public function c() { echo 'd' . PHP_EOL; } } $foo = new A(); echo '$f->d() is callable: ' . is_callable(array($foo, 'c')) . PHP_EOL; $foo->b(array($foo, 'c'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAf9r
function name:  (null)
number of ops:  18
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   NEW                                              $1      'Test%5CA'
          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      'c'
          6        SEND_VAL_EX                                              ~4
          7        DO_FCALL                                      0  $5      
          8        CONCAT                                           ~6      '%24f-%3Ed%28%29+is+callable%3A+', $5
          9        FETCH_CONSTANT                                   ~7      'Test%5CPHP_EOL'
         10        CONCAT                                           ~8      ~6, ~7
         11        ECHO                                                     ~8
   20    12        INIT_METHOD_CALL                                         !0, 'b'
         13        INIT_ARRAY                                       ~9      !0
         14        ADD_ARRAY_ELEMENT                                ~9      'c'
         15        SEND_VAL_EX                                              ~9
         16        DO_FCALL                                      0          
         17      > RETURN                                                   1

Class Test\A:
Function b:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAf9r
function name:  b
number of ops:  4
compiled vars:  !0 = $b
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 b

Function c:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tAf9r
function name:  c
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      'd', ~0
          2        ECHO                                                     ~1
   15     3      > RETURN                                                   null

End of function c

End of class Test\A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.67 ms | 1396 KiB | 15 Q