3v4l.org

run code in 300+ PHP versions simultaneously
<?php // A simple test object class testObj { private $id; static private $sid; public function controller(array $array) { $this->id=$array; } public function setId($newId) { $this->id = $newId; } public function staticcontroller(array $array) { self::$sid=$array; } } class testFacade { function driver() { return "testObj"; } public static function __callStatic($method, $parameters) { return call_user_func_array(array(static::driver(), $method), $parameters); } } $params=array("a"=>1,"b"=>2,"c"=>3,"p"=>$_GET["m"]); $method=$_GET["m"]; for($i=0;$i<10;$i++) switch ($method) { case "variable": $a = "testObj"; $method = "setId"; $test1 = new $a; $test1->$method($_GET["m"]); $method = "controller"; $test1->$method($params); break; case "reflexion": $a = "testObj"; $method = "setId"; $reflectionClass = new ReflectionClass($a); $test2 = $reflectionClass->newInstance(); $reflectionMethod = $reflectionClass->getMethod($method); $reflectionMethod->invoke($test2,33); $method = "controller"; $reflectionMethod = $reflectionClass->getMethod($method); $reflectionMethod->invoke($test2,$params); break; case "call_user_func_array": $a = "testObj"; $test1 = new $a; $method = "setId"; $r=call_user_func_array(array($test1, $method), array(1)); $method = "controller"; $r=call_user_func_array(array($test1, $method), array( $params)); break; case "static1": testObj::staticcontroller($params); break; case "static2": $a = "testObj"; $method = "staticcontroller"; $a::$method($params); break; case "static3": testFacade::staticcontroller( $params); break; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 109
Branch analysis from position: 109
2 jumps found. (Code = 44) Position 1 = 111, Position 2 = 12
Branch analysis from position: 111
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
8 jumps found. (Code = 188) Position 1 = 26, Position 2 = 43, Position 3 = 70, Position 4 = 93, Position 5 = 97, Position 6 = 104, Position 7 = 108, Position 8 = 13
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
2 jumps found. (Code = 44) Position 1 = 111, Position 2 = 12
Branch analysis from position: 111
Branch analysis from position: 12
Branch analysis from position: 43
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 70
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 93
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 97
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 104
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 108
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 15, Position 2 = 26
Branch analysis from position: 15
2 jumps found. (Code = 44) Position 1 = 17, Position 2 = 43
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 70
Branch analysis from position: 19
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 93
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 23, Position 2 = 97
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 25, Position 2 = 104
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 108
Branch analysis from position: 108
Branch analysis from position: 104
Branch analysis from position: 97
Branch analysis from position: 93
Branch analysis from position: 70
Branch analysis from position: 43
Branch analysis from position: 26
filename:       /in/Kb2F0
function name:  (null)
number of ops:  112
compiled vars:  !0 = $params, !1 = $method, !2 = $i, !3 = $a, !4 = $test1, !5 = $reflectionClass, !6 = $test2, !7 = $reflectionMethod, !8 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   INIT_ARRAY                                       ~9      1, 'a'
          1        ADD_ARRAY_ELEMENT                                ~9      2, 'b'
          2        ADD_ARRAY_ELEMENT                                ~9      3, 'c'
          3        FETCH_R                      global              ~10     '_GET'
          4        FETCH_DIM_R                                      ~11     ~10, 'm'
          5        ADD_ARRAY_ELEMENT                                ~9      ~11, 'p'
          6        ASSIGN                                                   !0, ~9
   43     7        FETCH_R                      global              ~13     '_GET'
          8        FETCH_DIM_R                                      ~14     ~13, 'm'
          9        ASSIGN                                                   !1, ~14
   45    10        ASSIGN                                                   !2, 0
         11      > JMP                                                      ->109
   46    12    > > SWITCH_STRING                                            !1, [ 'variable':->26, 'reflexion':->43, 'call_user_func_array':->70, 'static1':->93, 'static2':->97, 'static3':->104, ], ->108
   48    13    >   IS_EQUAL                                                 !1, 'variable'
         14      > JMPNZ                                                    ~17, ->26
   58    15    >   IS_EQUAL                                                 !1, 'reflexion'
         16      > JMPNZ                                                    ~17, ->43
   71    17    >   IS_EQUAL                                                 !1, 'call_user_func_array'
         18      > JMPNZ                                                    ~17, ->70
   84    19    >   IS_EQUAL                                                 !1, 'static1'
         20      > JMPNZ                                                    ~17, ->93
   88    21    >   IS_EQUAL                                                 !1, 'static2'
         22      > JMPNZ                                                    ~17, ->97
   95    23    >   IS_EQUAL                                                 !1, 'static3'
         24      > JMPNZ                                                    ~17, ->104
         25    > > JMP                                                      ->108
   49    26    >   ASSIGN                                                   !3, 'testObj'
   50    27        ASSIGN                                                   !1, 'setId'
   51    28        FETCH_CLASS                                   0  $20     !3
         29        NEW                                              $21     $20
         30        DO_FCALL                                      0          
         31        ASSIGN                                                   !4, $21
   52    32        INIT_METHOD_CALL                                         !4, !1
         33        CHECK_FUNC_ARG                                           
         34        FETCH_FUNC_ARG               global              $24     '_GET'
         35        FETCH_DIM_FUNC_ARG                               $25     $24, 'm'
         36        SEND_FUNC_ARG                                            $25
         37        DO_FCALL                                      0          
   54    38        ASSIGN                                                   !1, 'controller'
   55    39        INIT_METHOD_CALL                                         !4, !1
         40        SEND_VAR_EX                                              !0
         41        DO_FCALL                                      0          
   56    42      > JMP                                                      ->108
   59    43    >   ASSIGN                                                   !3, 'testObj'
   60    44        ASSIGN                                                   !1, 'setId'
   61    45        NEW                                              $31     'ReflectionClass'
         46        SEND_VAR_EX                                              !3
         47        DO_FCALL                                      0          
         48        ASSIGN                                                   !5, $31
   62    49        INIT_METHOD_CALL                                         !5, 'newInstance'
         50        DO_FCALL                                      0  $34     
         51        ASSIGN                                                   !6, $34
   63    52        INIT_METHOD_CALL                                         !5, 'getMethod'
         53        SEND_VAR_EX                                              !1
         54        DO_FCALL                                      0  $36     
         55        ASSIGN                                                   !7, $36
   64    56        INIT_METHOD_CALL                                         !7, 'invoke'
         57        SEND_VAR_EX                                              !6
         58        SEND_VAL_EX                                              33
         59        DO_FCALL                                      0          
   66    60        ASSIGN                                                   !1, 'controller'
   67    61        INIT_METHOD_CALL                                         !5, 'getMethod'
         62        SEND_VAR_EX                                              !1
         63        DO_FCALL                                      0  $40     
         64        ASSIGN                                                   !7, $40
   68    65        INIT_METHOD_CALL                                         !7, 'invoke'
         66        SEND_VAR_EX                                              !6
         67        SEND_VAR_EX                                              !0
         68        DO_FCALL                                      0          
   69    69      > JMP                                                      ->108
   72    70    >   ASSIGN                                                   !3, 'testObj'
   73    71        FETCH_CLASS                                   0  $44     !3
         72        NEW                                              $45     $44
         73        DO_FCALL                                      0          
         74        ASSIGN                                                   !4, $45
   75    75        ASSIGN                                                   !1, 'setId'
   76    76        INIT_ARRAY                                       ~49     !4
         77        ADD_ARRAY_ELEMENT                                ~49     !1
         78        INIT_USER_CALL                                0          'call_user_func_array', ~49
         79        SEND_ARRAY                                               <array>
         80        CHECK_UNDEF_ARGS                                         
         81        DO_FCALL                                      0  $50     
         82        ASSIGN                                                   !8, $50
   79    83        ASSIGN                                                   !1, 'controller'
   80    84        INIT_ARRAY                                       ~53     !4
         85        ADD_ARRAY_ELEMENT                                ~53     !1
         86        INIT_USER_CALL                                0          'call_user_func_array', ~53
         87        INIT_ARRAY                                       ~54     !0
         88        SEND_ARRAY                                               ~54
         89        CHECK_UNDEF_ARGS                                         
         90        DO_FCALL                                      0  $55     
         91        ASSIGN                                                   !8, $55
   81    92      > JMP                                                      ->108
   85    93    >   INIT_STATIC_METHOD_CALL                                  'testObj', 'staticcontroller'
         94        SEND_VAR                                                 !0
         95        DO_FCALL                                      0          
   86    96      > JMP                                                      ->108
   89    97    >   ASSIGN                                                   !3, 'testObj'
   90    98        ASSIGN                                                   !1, 'staticcontroller'
   92    99        FETCH_CLASS                                   0  $60     !3
        100        INIT_STATIC_METHOD_CALL                                  $60, !1
        101        SEND_VAR_EX                                              !0
        102        DO_FCALL                                      0          
   93   103      > JMP                                                      ->108
   96   104    >   INIT_STATIC_METHOD_CALL                                  'testFacade', 'staticcontroller'
        105        SEND_VAR_EX                                              !0
        106        DO_FCALL                                      0          
   97   107      > JMP                                                      ->108
   45   108    >   PRE_INC                                                  !2
        109    >   IS_SMALLER                                               !2, 10
        110      > JMPNZ                                                    ~64, ->12
   99   111    > > RETURN                                                   1

Class testObj:
Function controller:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kb2F0
function name:  controller
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   12     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   13     3      > RETURN                                                   null

End of function controller

Function setid:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kb2F0
function name:  setId
number of ops:  4
compiled vars:  !0 = $newId
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
   17     1        ASSIGN_OBJ                                               'id'
          2        OP_DATA                                                  !0
   18     3      > RETURN                                                   null

End of function setid

Function staticcontroller:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kb2F0
function name:  staticcontroller
number of ops:  4
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   22     1        ASSIGN_STATIC_PROP                                       'sid'
          2        OP_DATA                                                  !0
   23     3      > RETURN                                                   null

End of function staticcontroller

End of class testObj.

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

End of function driver

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kb2F0
function name:  __callStatic
number of ops:  12
compiled vars:  !0 = $method, !1 = $parameters
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   36     2        INIT_STATIC_METHOD_CALL                                  'driver'
          3        DO_FCALL                                      0  $2      
          4        INIT_ARRAY                                       ~3      $2
          5        ADD_ARRAY_ELEMENT                                ~3      !0
          6        INIT_USER_CALL                                0          'call_user_func_array', ~3
          7        SEND_ARRAY                                               !1
          8        CHECK_UNDEF_ARGS                                         
          9        DO_FCALL                                      0  $4      
         10      > RETURN                                                   $4
   37    11*     > RETURN                                                   null

End of function __callstatic

End of class testFacade.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.37 ms | 1411 KiB | 13 Q