3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} class Bar { public function __construct($param1) {} } $reflection = new \ReflectionClass('Foo'); var_dump($reflection->newInstanceArgs(array())); try { var_dump($reflection->newInstanceArgs(array(1))); } catch (Exception $e) { echo $e; } $reflectionB = new \ReflectionClass('Bar'); var_dump($reflectionB->newInstanceArgs(array())); var_dump($reflectionB->newInstanceArgs(array(1))); var_dump($reflectionB->newInstanceArgs(array(1,2)));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 17
Branch analysis from position: 17
2 jumps found. (Code = 107) Position 1 = 18, Position 2 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jM8ph
function name:  (null)
number of ops:  42
compiled vars:  !0 = $reflection, !1 = $e, !2 = $reflectionB
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   NEW                                              $3      'ReflectionClass'
          1        SEND_VAL_EX                                              'Foo'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
    9     4        INIT_FCALL                                               'var_dump'
          5        INIT_METHOD_CALL                                         !0, 'newInstanceArgs'
          6        SEND_VAL_EX                                              <array>
          7        DO_FCALL                                      0  $6      
          8        SEND_VAR                                                 $6
          9        DO_ICALL                                                 
   11    10        INIT_FCALL                                               'var_dump'
         11        INIT_METHOD_CALL                                         !0, 'newInstanceArgs'
         12        SEND_VAL_EX                                              <array>
         13        DO_FCALL                                      0  $8      
         14        SEND_VAR                                                 $8
         15        DO_ICALL                                                 
         16      > JMP                                                      ->19
   12    17  E > > CATCH                                       last         'Exception'
   13    18    >   ECHO                                                     !1
   16    19    >   NEW                                              $10     'ReflectionClass'
         20        SEND_VAL_EX                                              'Bar'
         21        DO_FCALL                                      0          
         22        ASSIGN                                                   !2, $10
   17    23        INIT_FCALL                                               'var_dump'
         24        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         25        SEND_VAL_EX                                              <array>
         26        DO_FCALL                                      0  $13     
         27        SEND_VAR                                                 $13
         28        DO_ICALL                                                 
   18    29        INIT_FCALL                                               'var_dump'
         30        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         31        SEND_VAL_EX                                              <array>
         32        DO_FCALL                                      0  $15     
         33        SEND_VAR                                                 $15
         34        DO_ICALL                                                 
   19    35        INIT_FCALL                                               'var_dump'
         36        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         37        SEND_VAL_EX                                              <array>
         38        DO_FCALL                                      0  $17     
         39        SEND_VAR                                                 $17
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Class Foo: [no user functions]
Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jM8ph
function name:  __construct
number of ops:  2
compiled vars:  !0 = $param1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.7 ms | 1400 KiB | 15 Q