3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected static function myProtected($test) { var_dump(__METHOD__, $test); } public static function __callStatic($method, $args) { switch($method) { case 'foo' : echo 'You have called foo()'; var_dump($args); break; case 'helloWorld': echo 'Hello ' . $args[0]; break; case 'myProtected': return call_user_func_array( array(get_called_class(), 'myProtected'), $args ); break; default: echo "doesn't exist, sorry"; break; } } } Test::notFound(); Test::myProtected("hello"); Test::helloWorld("Nico");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2DqqV
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   INIT_STATIC_METHOD_CALL                                  'Test', 'notFound'
          1        DO_FCALL                                      0          
   35     2        INIT_STATIC_METHOD_CALL                                  'Test', 'myProtected'
          3        SEND_VAL_EX                                              'hello'
          4        DO_FCALL                                      0          
   36     5        INIT_STATIC_METHOD_CALL                                  'Test', 'helloWorld'
          6        SEND_VAL_EX                                              'Nico'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class Test:
Function myprotected:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2DqqV
function name:  myProtected
number of ops:  6
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_FCALL                                               'var_dump'
          2        SEND_VAL                                                 'Test%3A%3AmyProtected'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
    6     5      > RETURN                                                   null

End of function myprotected

Function __callstatic:
Finding entry points
Branch analysis from position: 0
5 jumps found. (Code = 188) Position 1 = 10, Position 2 = 15, Position 3 = 19, Position 4 = 28, Position 5 = 3
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
Branch analysis from position: 3
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 9, Position 2 = 19
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
Branch analysis from position: 19
Branch analysis from position: 15
Branch analysis from position: 10
filename:       /in/2DqqV
function name:  __callStatic
number of ops:  31
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2      > SWITCH_STRING                                            !0, [ 'foo':->10, 'helloWorld':->15, 'myProtected':->19, ], ->28
   10     3    >   IS_EQUAL                                                 !0, 'foo'
          4      > JMPNZ                                                    ~2, ->10
   15     5    >   IS_EQUAL                                                 !0, 'helloWorld'
          6      > JMPNZ                                                    ~2, ->15
   19     7    >   IS_EQUAL                                                 !0, 'myProtected'
          8      > JMPNZ                                                    ~2, ->19
          9    > > JMP                                                      ->28
   11    10    >   ECHO                                                     'You+have+called+foo%28%29'
   12    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !1
         13        DO_ICALL                                                 
   13    14      > JMP                                                      ->30
   16    15    >   FETCH_DIM_R                                      ~4      !1, 0
         16        CONCAT                                           ~5      'Hello+', ~4
         17        ECHO                                                     ~5
   17    18      > JMP                                                      ->30
   21    19    >   GET_CALLED_CLASS                                 ~6      
         20        INIT_ARRAY                                       ~7      ~6
         21        ADD_ARRAY_ELEMENT                                ~7      'myProtected'
         22        INIT_USER_CALL                                0          'call_user_func_array', ~7
   22    23        SEND_ARRAY                                               !1
         24        CHECK_UNDEF_ARGS                                         
         25        DO_FCALL                                      0  $8      
         26      > RETURN                                                   $8
   24    27*       JMP                                                      ->30
   26    28    >   ECHO                                                     'doesn%27t+exist%2C+sorry'
   27    29      > JMP                                                      ->30
   30    30    > > RETURN                                                   null

End of function __callstatic

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
240.83 ms | 1400 KiB | 15 Q