3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function callme(callable $callback) { //call_user_func($callback); $callback(); } public function hi() { echo 'A->hi()' . PHP_EOL; } public static function hiStatic() { echo 'A::hiStatic()' . PHP_EOL; } } class B extends A { public function callme(callable $callback) { //call_user_func($callback); $callback(); } public function hi() { echo 'B->hi()' . PHP_EOL; } public static function hiStatic() { echo 'B::hiStatic()' . PHP_EOL; } } $a = new A(); $b = new B(); $a->callme(array($a, 'hi')); echo "####################\n"; $a->callme(array('A', 'hiStatic')); $a->callme('A::hiStatic'); $a->callme(array('self', 'hiStatic')); $a->callme('self::hiStatic'); $a->callme(array('static', 'hiStatic')); $a->callme('static::hiStatic'); echo "####################\n"; $b->callme(array('B', 'hiStatic')); $b->callme(array('self', 'hiStatic')); $b->callme(array('static', 'hiStatic')); echo "####################\n"; $b->callme('B::hiStatic'); $b->callme('self::hiStatic'); $b->callme('static::hiStatic'); echo "####################\n"; $b->callme(array('parent', 'hi')); $b->callme(array('parent', 'hiStatic')); echo "####################\n"; $b->callme('parent::hi'); $b->callme('parent::hiStatic');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  (null)
number of ops:  65
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   23     0  E >   NEW                                                  $2      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   24     3        NEW                                                  $5      'B'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
   26     6        INIT_METHOD_CALL                                             !0, 'callme'
          7        INIT_ARRAY                                           ~8      !0
          8        ADD_ARRAY_ELEMENT                                    ~8      'hi'
          9        SEND_VAL_EX                                                  ~8
         10        DO_FCALL                                          0          
   28    11        ECHO                                                         '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   29    12        INIT_METHOD_CALL                                             !0, 'callme'
         13        SEND_VAL_EX                                                  <array>
         14        DO_FCALL                                          0          
   30    15        INIT_METHOD_CALL                                             !0, 'callme'
         16        SEND_VAL_EX                                                  'A%3A%3AhiStatic'
         17        DO_FCALL                                          0          
   31    18        INIT_METHOD_CALL                                             !0, 'callme'
         19        SEND_VAL_EX                                                  <array>
         20        DO_FCALL                                          0          
   32    21        INIT_METHOD_CALL                                             !0, 'callme'
         22        SEND_VAL_EX                                                  'self%3A%3AhiStatic'
         23        DO_FCALL                                          0          
   33    24        INIT_METHOD_CALL                                             !0, 'callme'
         25        SEND_VAL_EX                                                  <array>
         26        DO_FCALL                                          0          
   34    27        INIT_METHOD_CALL                                             !0, 'callme'
         28        SEND_VAL_EX                                                  'static%3A%3AhiStatic'
         29        DO_FCALL                                          0          
   36    30        ECHO                                                         '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   37    31        INIT_METHOD_CALL                                             !1, 'callme'
         32        SEND_VAL_EX                                                  <array>
         33        DO_FCALL                                          0          
   38    34        INIT_METHOD_CALL                                             !1, 'callme'
         35        SEND_VAL_EX                                                  <array>
         36        DO_FCALL                                          0          
   39    37        INIT_METHOD_CALL                                             !1, 'callme'
         38        SEND_VAL_EX                                                  <array>
         39        DO_FCALL                                          0          
   41    40        ECHO                                                         '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   42    41        INIT_METHOD_CALL                                             !1, 'callme'
         42        SEND_VAL_EX                                                  'B%3A%3AhiStatic'
         43        DO_FCALL                                          0          
   43    44        INIT_METHOD_CALL                                             !1, 'callme'
         45        SEND_VAL_EX                                                  'self%3A%3AhiStatic'
         46        DO_FCALL                                          0          
   44    47        INIT_METHOD_CALL                                             !1, 'callme'
         48        SEND_VAL_EX                                                  'static%3A%3AhiStatic'
         49        DO_FCALL                                          0          
   46    50        ECHO                                                         '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   47    51        INIT_METHOD_CALL                                             !1, 'callme'
         52        SEND_VAL_EX                                                  <array>
         53        DO_FCALL                                          0          
   48    54        INIT_METHOD_CALL                                             !1, 'callme'
         55        SEND_VAL_EX                                                  <array>
         56        DO_FCALL                                          0          
   50    57        ECHO                                                         '%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%23%0A'
   51    58        INIT_METHOD_CALL                                             !1, 'callme'
         59        SEND_VAL_EX                                                  'parent%3A%3Ahi'
         60        DO_FCALL                                          0          
   52    61        INIT_METHOD_CALL                                             !1, 'callme'
         62        SEND_VAL_EX                                                  'parent%3A%3AhiStatic'
         63        DO_FCALL                                          0          
         64      > RETURN                                                       1

Class A:
Function callme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  callme
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
    6     1        INIT_DYNAMIC_CALL                                            !0
          2        DO_FCALL                                          0          
    7     3      > RETURN                                                       null

End of function callme

Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  hi
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'A-%3Ehi%28%29%0A'
          1      > RETURN                                                       null

End of function hi

Function histatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  hiStatic
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                         'A%3A%3AhiStatic%28%29%0A'
          1      > RETURN                                                       null

End of function histatic

End of class A.

Class B:
Function callme:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  callme
number of ops:  4
compiled vars:  !0 = $callback
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E >   RECV                                                 !0      
   16     1        INIT_DYNAMIC_CALL                                            !0
          2        DO_FCALL                                          0          
   17     3      > RETURN                                                       null

End of function callme

Function hi:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  hi
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   ECHO                                                         'B-%3Ehi%28%29%0A'
          1      > RETURN                                                       null

End of function hi

Function histatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/1oSO3
function name:  hiStatic
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   ECHO                                                         'B%3A%3AhiStatic%28%29%0A'
          1      > RETURN                                                       null

End of function histatic

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.53 ms | 2715 KiB | 13 Q