3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo extends ReflectionClass { public function newInstance($arg=null, ...$args) { $args = \array_slice(\array_merge([$arg], $args), 0, \func_num_args()); return parent::newInstance(...$args); } } $foo = new Foo(Exception::class); $ex = $foo->newInstance('Test', 0); var_dump($ex);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeVf8
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo, !1 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $2      'Foo'
          1        SEND_VAL_EX                                              'Exception'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $2
   13     4        INIT_METHOD_CALL                                         !0, 'newInstance'
          5        SEND_VAL_EX                                              'Test'
          6        SEND_VAL_EX                                              0
          7        DO_FCALL                                      0  $5      
          8        ASSIGN                                                   !1, $5
   14     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !1
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Class Foo:
Function newinstance:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eeVf8
function name:  newInstance
number of ops:  20
compiled vars:  !0 = $arg, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV_INIT                                        !0      null
          1        RECV_VARIADIC                                    !1      
    7     2        INIT_FCALL                                               'array_slice'
          3        INIT_FCALL                                               'array_merge'
          4        INIT_ARRAY                                       ~2      !0
          5        SEND_VAL                                                 ~2
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $3      
          8        SEND_VAR                                                 $3
          9        SEND_VAL                                                 0
         10        FUNC_NUM_ARGS                                    ~4      
         11        SEND_VAL                                                 ~4
         12        DO_ICALL                                         $5      
         13        ASSIGN                                                   !1, $5
    8    14        INIT_STATIC_METHOD_CALL                                  'newInstance'
         15        SEND_UNPACK                                              !1
         16        CHECK_UNDEF_ARGS                                         
         17        DO_FCALL                                      1  $7      
         18      > RETURN                                                   $7
    9    19*     > RETURN                                                   null

End of function newinstance

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.07 ms | 1401 KiB | 19 Q