3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static function name() { return 'A'; } function a() { $f = function() { return static::name(); }; echo static::class, " vs ", $f(), PHP_EOL; } } class B extends A { static function name() { return 'B'; } } $b = new B; $b->a();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWZAb
function name:  (null)
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   22     3        INIT_METHOD_CALL                                         !0, 'a'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FFWZAb%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWZAb
function name:  {closure}
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_STATIC_METHOD_CALL                                  'name'
          1        DO_FCALL                                      0  $0      
          2      > RETURN                                                   $0
   10     3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FFWZAb%3A8%240

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

End of function name

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWZAb
function name:  a
number of ops:  10
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFWZAb%3A8%240'
          1        ASSIGN                                                   !0, ~1
   11     2        FETCH_CLASS_NAME                                 ~3      
          3        ECHO                                                     ~3
          4        ECHO                                                     '+vs+'
          5        INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8        ECHO                                                     '%0A'
   12     9      > RETURN                                                   null

End of function a

End of class A.

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

End of function name

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FWZAb
function name:  a
number of ops:  10
compiled vars:  !0 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FFWZAb%3A8%240'
          1        ASSIGN                                                   !0, ~1
   11     2        FETCH_CLASS_NAME                                 ~3      
          3        ECHO                                                     ~3
          4        ECHO                                                     '+vs+'
          5        INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0  $4      
          7        ECHO                                                     $4
          8        ECHO                                                     '%0A'
   12     9      > RETURN                                                   null

End of function a

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.7 ms | 1399 KiB | 13 Q