3v4l.org

run code in 300+ PHP versions simultaneously
<?php class f { function f(&$e, &$u, $f=false) { } } function getNew() { $a = func_get_args(); $c = array_shift($a); $a[1] = new stdClass; var_dump($a[1]); foreach ($a as $k => &$value) $a[$k] = $value; //return call_user_func_array(array('f', 'f'), $c); $r = new ReflectionClass($c); return $r->newInstanceArgs($a); } function getNew2($c, $e, $u) { $r = new ReflectionClass($c); return $r->newInstance($e,$u); } $e = new stdClass; $u = new stdClass; var_dump($e); var_dump(getNew('f', $e, $u)); var_dump($e);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F5gEB
function name:  (null)
number of ops:  21
compiled vars:  !0 = $e, !1 = $u
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $2      'stdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   33     3        NEW                                              $5      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   35     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   36     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'getnew'
         11        SEND_VAL                                                 'f'
         12        SEND_VAR                                                 !0
         13        SEND_VAR                                                 !1
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
   37    17        INIT_FCALL                                               'var_dump'
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                                 
         20      > RETURN                                                   1

Function getnew:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
2 jumps found. (Code = 126) Position 1 = 16, Position 2 = 20
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 15
Branch analysis from position: 15
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/F5gEB
function name:  getNew
number of ops:  30
compiled vars:  !0 = $a, !1 = $c, !2 = $value, !3 = $k, !4 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FUNC_GET_ARGS                                    ~5      
          1        ASSIGN                                                   !0, ~5
   14     2        INIT_FCALL                                               'array_shift'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !1, $7
   16     6        NEW                                              $10     'stdClass'
          7        DO_FCALL                                      0          
          8        ASSIGN_DIM                                               !0, 1
          9        OP_DATA                                                  $10
   17    10        INIT_FCALL                                               'var_dump'
         11        FETCH_DIM_R                                      ~12     !0, 1
         12        SEND_VAL                                                 ~12
         13        DO_ICALL                                                 
   18    14      > FE_RESET_RW                                      $14     !0, ->20
         15    > > FE_FETCH_RW                                      ~15     $14, !2, ->20
         16    >   ASSIGN                                                   !3, ~15
   19    17        ASSIGN_DIM                                               !0, !3
         18        OP_DATA                                                  !2
   18    19      > JMP                                                      ->15
         20    >   FE_FREE                                                  $14
   22    21        NEW                                              $18     'ReflectionClass'
         22        SEND_VAR_EX                                              !1
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !4, $18
   23    25        INIT_METHOD_CALL                                         !4, 'newInstanceArgs'
         26        SEND_VAR_EX                                              !0
         27        DO_FCALL                                      0  $21     
         28      > RETURN                                                   $21
   24    29*     > RETURN                                                   null

End of function getnew

Function getnew2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F5gEB
function name:  getNew2
number of ops:  13
compiled vars:  !0 = $c, !1 = $e, !2 = $u, !3 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
   28     3        NEW                                              $4      'ReflectionClass'
          4        SEND_VAR_EX                                              !0
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !3, $4
   29     7        INIT_METHOD_CALL                                         !3, 'newInstance'
          8        SEND_VAR_EX                                              !1
          9        SEND_VAR_EX                                              !2
         10        DO_FCALL                                      0  $7      
         11      > RETURN                                                   $7
   30    12*     > RETURN                                                   null

End of function getnew2

Class f:
Function f:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/F5gEB
function name:  f
number of ops:  4
compiled vars:  !0 = $e, !1 = $u, !2 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV_INIT                                        !2      <false>
    7     3      > RETURN                                                   null

End of function f

End of class f.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.85 ms | 1394 KiB | 18 Q