3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class Foo { public bool $bar; public array $baz; public function __construct( bool $bar = false, array $baz = [], ) { $this->bar = $bar; $this->baz = $baz; } } final class Bar { public bool $bar = false; public array $baz = []; public function __construct( bool $bar = false, array $baz = [], ) { $this->bar = $bar; $this->baz = $baz; } } $create = static fn(string $class): object => (new \ReflectionClass($class))->newInstanceWithoutConstructor(); var_dump($create(Foo::class)); var_dump($create(Bar::class));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0tLcM
function name:  (null)
number of ops:  15
compiled vars:  !0 = $create
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   DECLARE_LAMBDA_FUNCTION                          ~1      [0]
          1        ASSIGN                                                   !0, ~1
   34     2        INIT_FCALL                                               'var_dump'
          3        INIT_DYNAMIC_CALL                                        !0
          4        SEND_VAL_EX                                              'Foo'
          5        DO_FCALL                                      0  $3      
          6        SEND_VAR                                                 $3
          7        DO_ICALL                                                 
   35     8        INIT_FCALL                                               'var_dump'
          9        INIT_DYNAMIC_CALL                                        !0
         10        SEND_VAL_EX                                              'Bar'
         11        DO_FCALL                                      0  $5      
         12        SEND_VAR                                                 $5
         13        DO_ICALL                                                 
         14      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0tLcM
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        NEW                                              $1      'ReflectionClass'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
          4        INIT_METHOD_CALL                                         $1, 'newInstanceWithoutConstructor'
          5        DO_FCALL                                      0  $3      
          6        VERIFY_RETURN_TYPE                                       $3
          7      > RETURN                                                   $3
          8*       VERIFY_RETURN_TYPE                                       
          9*     > RETURN                                                   null

End of Dynamic Function 0

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0tLcM
function name:  __construct
number of ops:  7
compiled vars:  !0 = $bar, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV_INIT                                        !0      <false>
          1        RECV_INIT                                        !1      <array>
   12     2        ASSIGN_OBJ                                               'bar'
          3        OP_DATA                                                  !0
   13     4        ASSIGN_OBJ                                               'baz'
          5        OP_DATA                                                  !1
   14     6      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/0tLcM
function name:  __construct
number of ops:  7
compiled vars:  !0 = $bar, !1 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   RECV_INIT                                        !0      <false>
          1        RECV_INIT                                        !1      <array>
   27     2        ASSIGN_OBJ                                               'bar'
          3        OP_DATA                                                  !0
   28     4        ASSIGN_OBJ                                               'baz'
          5        OP_DATA                                                  !1
   29     6      > RETURN                                                   null

End of function __construct

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.12 ms | 1002 KiB | 14 Q