3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Name; function Boo() { var_dump('func:', __FUNCTION__, __METHOD__); } trait Constants { public static function traitC () { return __CLASS__; } } class Foo { use Constants; public function method () { return function () { var_dump(__FUNCTION__, __METHOD__); };} } class Bar extends Foo { } var_dump(Foo::traitC(), Bar::traitC());die(); $stdClass = new \stdClass(); $closure = (new Foo())->method(); $closure(); $closure = $closure->bindTo($stdClass); $closure(); $ref = new \ReflectionFunction($closure); var_dump($ref->getName());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/XJajm
function name:  (null)
number of ops:  37
compiled vars:  !0 = $stdClass, !1 = $closure, !2 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'name%5Cfoo'
   15     1        DECLARE_CLASS                                            'name%5Cbar', 'name%5Cfoo'
   18     2        INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
          3        INIT_STATIC_METHOD_CALL                                  'Name%5CFoo', 'traitC'
          4        DO_FCALL                                      0  $3      
          5        SEND_VAR_NO_REF_EX                                       $3
          6        INIT_STATIC_METHOD_CALL                                  'Name%5CBar', 'traitC'
          7        DO_FCALL                                      0  $4      
          8        SEND_VAR_NO_REF_EX                                       $4
          9        DO_FCALL                                      0          
         10      > EXIT                                                     
   19    11*       NEW                                              $6      'stdClass'
         12*       DO_FCALL                                      0          
         13*       ASSIGN                                                   !0, $6
   20    14*       NEW                                              $9      'Name%5CFoo'
         15*       DO_FCALL                                      0          
         16*       INIT_METHOD_CALL                                         $9, 'method'
         17*       DO_FCALL                                      0  $11     
         18*       ASSIGN                                                   !1, $11
   21    19*       INIT_DYNAMIC_CALL                                        !1
         20*       DO_FCALL                                      0          
   22    21*       INIT_METHOD_CALL                                         !1, 'bindTo'
         22*       SEND_VAR_EX                                              !0
         23*       DO_FCALL                                      0  $14     
         24*       ASSIGN                                                   !1, $14
   23    25*       INIT_DYNAMIC_CALL                                        !1
         26*       DO_FCALL                                      0          
   24    27*       NEW                                              $17     'ReflectionFunction'
         28*       SEND_VAR_EX                                              !1
         29*       DO_FCALL                                      0          
         30*       ASSIGN                                                   !2, $17
   25    31*       INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
         32*       INIT_METHOD_CALL                                         !2, 'getName'
         33*       DO_FCALL                                      0  $20     
         34*       SEND_VAR_NO_REF_EX                                       $20
         35*       DO_FCALL                                      0          
         36*     > RETURN                                                   1

Function name%5Cboo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJajm
function name:  Name\Boo
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
          1        SEND_VAL_EX                                              'func%3A'
          2        SEND_VAL_EX                                              'Name%5CBoo'
          3        SEND_VAL_EX                                              'Name%5CBoo'
          4        DO_FCALL                                      0          
    6     5      > RETURN                                                   null

End of function name%5Cboo

Function %00name%5C%7Bclosure%7D%2Fin%2FXJajm%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJajm
function name:  Name\{closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
          1        SEND_VAL_EX                                              'Name%5C%7Bclosure%7D'
          2        SEND_VAL_EX                                              'Name%5C%7Bclosure%7D'
          3        DO_FCALL                                      0          
          4      > RETURN                                                   null

End of function %00name%5C%7Bclosure%7D%2Fin%2FXJajm%3A13%240

Class Name\Constants:
Function traitc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJajm
function name:  traitC
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_CLASS_NAME                                 ~0      
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function traitc

End of class Name\Constants.

Class Name\Foo:
Function method:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XJajm
function name:  method
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00name%5C%7Bclosure%7D%2Fin%2FXJajm%3A13%240'
          1      > RETURN                                                   ~0
          2*     > RETURN                                                   null

End of function method

End of class Name\Foo.

Class Name\Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.56 ms | 1400 KiB | 15 Q