3v4l.org

run code in 300+ PHP versions simultaneously
l<?php class A { public function dd() { echo get_called_class(); } public static function foo() { $f = array(self, 'bar'); return $f(); //return static::bar(); } } class B extends A { public static function bar() { echo 'bar'; } } B::foo(); echo "\n"; echo __CLASS__."\n"; $a = new A; $a->dd();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  (null)
number of ops:  11
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    1     0  E >   ECHO                                                     'l'
   19     1        INIT_STATIC_METHOD_CALL                                  'B', 'foo'
          2        DO_FCALL                                      0          
   21     3        ECHO                                                     '%0A'
   22     4        ECHO                                                     '%0A'
   24     5        NEW                                              $2      'A'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !0, $2
   25     8        INIT_METHOD_CALL                                         !0, 'dd'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class A:
Function dd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  dd
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GET_CALLED_CLASS                                 ~0      
          1        ECHO                                                     ~0
    5     2      > RETURN                                                   null

End of function dd

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  foo
number of ops:  8
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CONSTANT                                   ~1      'self'
          1        INIT_ARRAY                                       ~2      ~1
          2        ADD_ARRAY_ELEMENT                                ~2      'bar'
          3        ASSIGN                                                   !0, ~2
    8     4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0  $4      
          6      > RETURN                                                   $4
   10     7*     > RETURN                                                   null

End of function foo

End of class A.

Class B:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   ECHO                                                     'bar'
   16     1      > RETURN                                                   null

End of function bar

Function dd:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  dd
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   GET_CALLED_CLASS                                 ~0      
          1        ECHO                                                     ~0
    5     2      > RETURN                                                   null

End of function dd

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/c0u0v
function name:  foo
number of ops:  8
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_CONSTANT                                   ~1      'self'
          1        INIT_ARRAY                                       ~2      ~1
          2        ADD_ARRAY_ELEMENT                                ~2      'bar'
          3        ASSIGN                                                   !0, ~2
    8     4        INIT_DYNAMIC_CALL                                        !0
          5        DO_FCALL                                      0  $4      
          6      > RETURN                                                   $4
   10     7*     > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.1 ms | 1390 KiB | 13 Q