3v4l.org

run code in 300+ PHP versions simultaneously
<?php class x { const CONSTANT = 'const'; public static function func() { return __METHOD__; } } function call(callable $func) { $func(); } $class = 'x'; $function = 'func'; $classFunc1 = array($class, $function); $classFunc2 = $class . '::' . $function; var_dump($class::func()); var_dump($class::$function()); var_dump($classFunc1()); //var_dump($classFunc2()); var_dump(call($class::func())); var_dump(call($class::$function())); var_dump(call($classFunc1())); // var_dump(call($classFunc2()));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dc5Dh
function name:  (null)
number of ops:  52
compiled vars:  !0 = $class, !1 = $function, !2 = $classFunc1, !3 = $classFunc2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   ASSIGN                                                   !0, 'x'
   15     1        ASSIGN                                                   !1, 'func'
   16     2        INIT_ARRAY                                       ~6      !0
          3        ADD_ARRAY_ELEMENT                                ~6      !1
          4        ASSIGN                                                   !2, ~6
   17     5        CONCAT                                           ~8      !0, '%3A%3A'
          6        CONCAT                                           ~9      ~8, !1
          7        ASSIGN                                                   !3, ~9
   19     8        INIT_FCALL                                               'var_dump'
          9        FETCH_CLASS                                   0  $11     !0
         10        INIT_STATIC_METHOD_CALL                                  $11, 'func'
         11        DO_FCALL                                      0  $12     
         12        SEND_VAR                                                 $12
         13        DO_ICALL                                                 
   20    14        INIT_FCALL                                               'var_dump'
         15        FETCH_CLASS                                   0  $14     !0
         16        INIT_STATIC_METHOD_CALL                                  $14, !1
         17        DO_FCALL                                      0  $15     
         18        SEND_VAR                                                 $15
         19        DO_ICALL                                                 
   21    20        INIT_FCALL                                               'var_dump'
         21        INIT_DYNAMIC_CALL                                        !2
         22        DO_FCALL                                      0  $17     
         23        SEND_VAR                                                 $17
         24        DO_ICALL                                                 
   24    25        INIT_FCALL                                               'var_dump'
         26        INIT_FCALL                                               'call'
         27        FETCH_CLASS                                   0  $19     !0
         28        INIT_STATIC_METHOD_CALL                                  $19, 'func'
         29        DO_FCALL                                      0  $20     
         30        SEND_VAR                                                 $20
         31        DO_FCALL                                      0  $21     
         32        SEND_VAR                                                 $21
         33        DO_ICALL                                                 
   25    34        INIT_FCALL                                               'var_dump'
         35        INIT_FCALL                                               'call'
         36        FETCH_CLASS                                   0  $23     !0
         37        INIT_STATIC_METHOD_CALL                                  $23, !1
         38        DO_FCALL                                      0  $24     
         39        SEND_VAR                                                 $24
         40        DO_FCALL                                      0  $25     
         41        SEND_VAR                                                 $25
         42        DO_ICALL                                                 
   26    43        INIT_FCALL                                               'var_dump'
         44        INIT_FCALL                                               'call'
         45        INIT_DYNAMIC_CALL                                        !2
         46        DO_FCALL                                      0  $27     
         47        SEND_VAR                                                 $27
         48        DO_FCALL                                      0  $28     
         49        SEND_VAR                                                 $28
         50        DO_ICALL                                                 
   27    51      > RETURN                                                   1

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

End of function call

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

End of function func

End of class x.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.84 ms | 1407 KiB | 18 Q