3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Thing { public function __construct($one, $two, $three) { var_dump($one, $two, $three); } } abstract class VarArgsFactory { public function __construct() { $this->reflector = new \ReflectionClass($this->getClassName()); } public function create() { return $this->reflector->newInstanceArgs(func_get_args()); } abstract public function getClassName(); } class ThingFactory extends VarArgsFactory { public function getClassName() { return Thing::class; } } (new ThingFactory)->create(1, 2, 3);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $0      'ThingFactory'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'create'
          3        SEND_VAL_EX                                              1
          4        SEND_VAL_EX                                              2
          5        SEND_VAL_EX                                              3
          6        DO_FCALL                                      0          
          7      > RETURN                                                   1

Class Thing:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  __construct
number of ops:  9
compiled vars:  !0 = $one, !1 = $two, !2 = $three
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
    7     3        INIT_FCALL                                               'var_dump'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                                 
    8     8      > RETURN                                                   null

End of function __construct

End of class Thing.

Class VarArgsFactory:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'ReflectionClass'
          1        INIT_METHOD_CALL                                         'getClassName'
          2        DO_FCALL                                      0  $2      
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               'reflector'
          6        OP_DATA                                                  $1
   16     7      > RETURN                                                   null

End of function __construct

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  create
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      'reflector'
          1        INIT_METHOD_CALL                                         ~0, 'newInstanceArgs'
          2        FUNC_GET_ARGS                                    ~1      
          3        SEND_VAL_EX                                              ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   21     6*     > RETURN                                                   null

End of function create

Function getclassname:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  getClassName
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E > > RETURN                                                   null

End of function getclassname

End of class VarArgsFactory.

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

End of function getclassname

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  __construct
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $1      'ReflectionClass'
          1        INIT_METHOD_CALL                                         'getClassName'
          2        DO_FCALL                                      0  $2      
          3        SEND_VAR_NO_REF_EX                                       $2
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               'reflector'
          6        OP_DATA                                                  $1
   16     7      > RETURN                                                   null

End of function __construct

Function create:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jHZm4
function name:  create
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_R                                      ~0      'reflector'
          1        INIT_METHOD_CALL                                         ~0, 'newInstanceArgs'
          2        FUNC_GET_ARGS                                    ~1      
          3        SEND_VAL_EX                                              ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   21     6*     > RETURN                                                   null

End of function create

End of class ThingFactory.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.21 ms | 1392 KiB | 15 Q