3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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)));
based on bVEgs
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: 19
Branch analysis from position: 19
2 jumps found. (Code = 107) Position 1 = 20, Position 2 = -2
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jM8ph
function name:  (null)
number of ops:  44
compiled vars:  !0 = $reflection, !1 = $e, !2 = $reflectionB
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   2     0  E >   NOP                                                      
   4     1        NOP                                                      
   8     2        NEW                                              $5      :-5
         3        SEND_VAL_EX                                              'Foo'
         4        DO_FCALL                                      0          
         5        ASSIGN                                                   !0, $5
   9     6        INIT_FCALL                                               'var_dump'
         7        INIT_METHOD_CALL                                         !0, 'newInstanceArgs'
         8        SEND_VAL_EX                                              <array>
         9        DO_FCALL                                      0  $8      
        10        SEND_VAR                                                 $8
        11        DO_ICALL                                                 
  11    12        INIT_FCALL                                               'var_dump'
        13        INIT_METHOD_CALL                                         !0, 'newInstanceArgs'
        14        SEND_VAL_EX                                              <array>
        15        DO_FCALL                                      0  $10     
        16        SEND_VAR                                                 $10
        17        DO_ICALL                                                 
        18      > JMP                                                      ->21
  12    19  E > > CATCH                                                    'Exception', !1
  13    20    >   ECHO                                                     !1
  16    21    >   NEW                                              $12     :8
        22        SEND_VAL_EX                                              'Bar'
        23        DO_FCALL                                      0          
        24        ASSIGN                                                   !2, $12
  17    25        INIT_FCALL                                               'var_dump'
        26        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
        27        SEND_VAL_EX                                              <array>
        28        DO_FCALL                                      0  $15     
        29        SEND_VAR                                                 $15
        30        DO_ICALL                                                 
  18    31        INIT_FCALL                                               'var_dump'
        32        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
        33        SEND_VAL_EX                                              <array>
        34        DO_FCALL                                      0  $17     
        35        SEND_VAR                                                 $17
        36        DO_ICALL                                                 
  19    37        INIT_FCALL                                               'var_dump'
        38        INIT_METHOD_CALL                                         !2, 'newInstanceArgs'
        39        SEND_VAL_EX                                              <array>
        40        DO_FCALL                                      0  $19     
        41        SEND_VAR                                                 $19
        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/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 7.3.0