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 var_dump(__CLASS__,__FUNCTION__, __METHOD__); } } class Foo { use Constants { traitC as traitConsts; } public function method () { return var_dump(__CLASS__,__FUNCTION__, __METHOD__);} } $stdClass = new \stdClass(); $closure = (new Foo())->method(); //$closure(); echo PHP_EOL; echo PHP_EOL; $closure = (new Foo())->traitConsts(); echo PHP_EOL; echo PHP_EOL; var_dump((new \ReflectionMethod(new Foo(), 'traitConsts'))->getName()); //$closure();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v7V6J
function name:  (null)
number of ops:  34
compiled vars:  !0 = $stdClass, !1 = $closure
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_CLASS                                            'name%5Cfoo'
   18     1        NEW                                              $2      'stdClass'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   19     4        NEW                                              $5      'Name%5CFoo'
          5        DO_FCALL                                      0          
          6        INIT_METHOD_CALL                                         $5, 'method'
          7        DO_FCALL                                      0  $7      
          8        ASSIGN                                                   !1, $7
   21     9        FETCH_CONSTANT                                   ~9      'Name%5CPHP_EOL'
         10        ECHO                                                     ~9
   22    11        FETCH_CONSTANT                                   ~10     'Name%5CPHP_EOL'
         12        ECHO                                                     ~10
   23    13        NEW                                              $11     'Name%5CFoo'
         14        DO_FCALL                                      0          
         15        INIT_METHOD_CALL                                         $11, 'traitConsts'
         16        DO_FCALL                                      0  $13     
         17        ASSIGN                                                   !1, $13
   24    18        FETCH_CONSTANT                                   ~15     'Name%5CPHP_EOL'
         19        ECHO                                                     ~15
   25    20        FETCH_CONSTANT                                   ~16     'Name%5CPHP_EOL'
         21        ECHO                                                     ~16
   26    22        INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
         23        NEW                                              $17     'ReflectionMethod'
         24        NEW                                              $18     'Name%5CFoo'
         25        DO_FCALL                                      0          
         26        SEND_VAR_NO_REF_EX                                       $18
         27        SEND_VAL_EX                                              'traitConsts'
         28        DO_FCALL                                      0          
         29        INIT_METHOD_CALL                                         $17, 'getName'
         30        DO_FCALL                                      0  $21     
         31        SEND_VAR_NO_REF_EX                                       $21
         32        DO_FCALL                                      0          
   27    33      > RETURN                                                   1

Function name%5Cboo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v7V6J
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

Class Name\Constants:
Function traitc:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/v7V6J
function name:  traitC
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
          1        FETCH_CLASS_NAME                                 ~0      
          2        SEND_VAL_EX                                              ~0
          3        SEND_VAL_EX                                              'traitC'
          4        SEND_VAL_EX                                              'Name%5CConstants%3A%3AtraitC'
          5        DO_FCALL                                      0  $1      
          6      > RETURN                                                   $1
          7*     > 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/v7V6J
function name:  method
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_NS_FCALL_BY_NAME                                    'Name%5Cvar_dump'
          1        SEND_VAL_EX                                              'Name%5CFoo'
          2        SEND_VAL_EX                                              'method'
          3        SEND_VAL_EX                                              'Name%5CFoo%3A%3Amethod'
          4        DO_FCALL                                      0  $0      
          5      > RETURN                                                   $0
          6*     > RETURN                                                   null

End of function method

End of class Name\Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.53 ms | 1400 KiB | 15 Q