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) { var_dump($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 = 21
Branch analysis from position: 21
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/bVEgs
function name:  (null)
number of ops:  44
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                                                      ->21
   12    17  E > > CATCH                                       last         'Exception'
   13    18    >   INIT_FCALL                                               'var_dump'
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                                 
   17    21    >   NEW                                              $11     'ReflectionClass'
         22        SEND_VAL_EX                                              'Bar'
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !2, $11
   18    25        INIT_FCALL                                               'var_dump'
         26        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         27        SEND_VAL_EX                                              <array>
         28        DO_FCALL                                      0  $14     
         29        SEND_VAR                                                 $14
         30        DO_ICALL                                                 
   19    31        INIT_FCALL                                               'var_dump'
         32        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         33        SEND_VAL_EX                                              <array>
         34        DO_FCALL                                      0  $16     
         35        SEND_VAR                                                 $16
         36        DO_ICALL                                                 
   20    37        INIT_FCALL                                               'var_dump'
         38        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
         39        SEND_VAL_EX                                              <array>
         40        DO_FCALL                                      0  $18     
         41        SEND_VAR                                                 $18
         42        DO_ICALL                                                 
         43      > 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/bVEgs
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:
160.05 ms | 1400 KiB | 15 Q