3v4l.org

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

End of function c

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

End of function d

End of class Test\A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.67 ms | 1400 KiB | 15 Q