3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function Hello() { return 'Hello World!'; } } class PHP { public function ObjInvoke(...$args) { if(isset($args[0]) && !empty($args[0])) { $class = $args[0]; $string = '$obj = new '.$class; if(isset($args[1])) { $arguments = array_shift(array_shift($args)); $string .= '('.$args[1]; foreach($arguments as $arg) { $string .= ', '.$arg; } $string .= ')'; } $string .= ';'; echo($string); } else { throw new BadFunctionCallException('You must a define a class to set as object.'); } } } $obj = new PHP; $obj->ObjInvoke();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/obHv8
function name:  (null)
number of ops:  6
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'PHP'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'ObjInvoke'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class A:
Function hello:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/obHv8
function name:  Hello
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E > > RETURN                                                   'Hello+World%21'
    5     1*     > RETURN                                                   null

End of function hello

End of class A.

Class PHP:
Function objinvoke:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 33
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 30
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 28
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 37
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
Branch analysis from position: 30
Branch analysis from position: 33
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 6
filename:       /in/obHv8
function name:  ObjInvoke
number of ops:  38
compiled vars:  !0 = $args, !1 = $class, !2 = $string, !3 = $arguments, !4 = $arg
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_VARIADIC                                    !0      
    9     1        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      !0, 0
          2      > JMPZ_EX                                          ~5      ~5, ->6
          3    >   ISSET_ISEMPTY_DIM_OBJ                         1  ~6      !0, 0
          4        BOOL_NOT                                         ~7      ~6
          5        BOOL                                             ~5      ~7
          6    > > JMPZ                                                     ~5, ->33
   10     7    >   FETCH_DIM_R                                      ~8      !0, 0
          8        ASSIGN                                                   !1, ~8
   11     9        CONCAT                                           ~10     '%24obj+%3D+new+', !1
         10        ASSIGN                                                   !2, ~10
   12    11        ISSET_ISEMPTY_DIM_OBJ                         0          !0, 1
         12      > JMPZ                                                     ~12, ->30
   13    13    >   INIT_FCALL                                               'array_shift'
         14        INIT_FCALL                                               'array_shift'
         15        SEND_REF                                                 !0
         16        DO_ICALL                                         $13     
         17        SEND_VAR_NO_REF                               0          $13
         18        DO_ICALL                                         $14     
         19        ASSIGN                                                   !3, $14
   14    20        FETCH_DIM_R                                      ~16     !0, 1
         21        CONCAT                                           ~17     '%28', ~16
         22        ASSIGN_OP                                     8          !2, ~17
   15    23      > FE_RESET_R                                       $19     !3, ->28
         24    > > FE_FETCH_R                                               $19, !4, ->28
   16    25    >   CONCAT                                           ~20     '%2C+', !4
         26        ASSIGN_OP                                     8          !2, ~20
   15    27      > JMP                                                      ->24
         28    >   FE_FREE                                                  $19
   18    29        ASSIGN_OP                                     8          !2, '%29'
   20    30    >   ASSIGN_OP                                     8          !2, '%3B'
   21    31        ECHO                                                     !2
         32      > JMP                                                      ->37
   24    33    >   NEW                                              $24     'BadFunctionCallException'
         34        SEND_VAL_EX                                              'You+must+a+define+a+class+to+set+as+object.'
         35        DO_FCALL                                      0          
         36      > THROW                                         0          $24
   26    37    > > RETURN                                                   null

End of function objinvoke

End of class PHP.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.25 ms | 1400 KiB | 15 Q