3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { private $foo; public function __construct($foo) { $this->foo = $foo; } public function foo() { return $this->foo; } 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_shit($args); $arguments = array_shift($arguments); $string .= '('.$args[1]; foreach($arguments as $arg) { $string .= ', '.$arg; } $string .= ')'; } $string .= ';'; echo($string); } else { print('You must a define a class to set as object.'); } } } $obj = new PHP; $obj->ObjInvoke('A', 'bar');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cm1K
function name:  (null)
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   36     0  E >   NEW                                              $1      'PHP'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   37     3        INIT_METHOD_CALL                                         !0, 'ObjInvoke'
          4        SEND_VAL_EX                                              'A'
          5        SEND_VAL_EX                                              'bar'
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cm1K
function name:  __construct
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_OBJ                                               'foo'
          2        OP_DATA                                                  !0
    6     3      > RETURN                                                   null

End of function __construct

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8cm1K
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function foo

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

End of function objinvoke

End of class PHP.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.02 ms | 1400 KiB | 15 Q