3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $label; public function __construct($label) { $this->label = $label; } } class Baz{} class Bar { public function test(Foo $foo = null) { if( is_null($foo) ) { $foo = new Foo('I am not magic.'); } var_dump($foo); } } $baz = new Bar(); $baz->test(new Foo('burp')); $baz->test(); $baz->test(new Baz());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rc2qH
function name:  (null)
number of ops:  17
compiled vars:  !0 = $baz
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $1      'Bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'test'
          4        NEW                                              $4      'Foo'
          5        SEND_VAL_EX                                              'burp'
          6        DO_FCALL                                      0          
          7        SEND_VAR_NO_REF_EX                                       $4
          8        DO_FCALL                                      0          
   24     9        INIT_METHOD_CALL                                         !0, 'test'
         10        DO_FCALL                                      0          
   25    11        INIT_METHOD_CALL                                         !0, 'test'
         12        NEW                                              $8      'Baz'
         13        DO_FCALL                                      0          
         14        SEND_VAR_NO_REF_EX                                       $8
         15        DO_FCALL                                      0          
         16      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rc2qH
function name:  __construct
number of ops:  4
compiled vars:  !0 = $label
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        ASSIGN_OBJ                                               'label'
          2        OP_DATA                                                  !0
    8     3      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Baz: [no user functions]
Class Bar:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 7
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/rc2qH
function name:  test
number of ops:  11
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV_INIT                                        !0      null
   15     1        TYPE_CHECK                                    2          !0
          2      > JMPZ                                                     ~1, ->7
   16     3    >   NEW                                              $2      'Foo'
          4        SEND_VAL_EX                                              'I+am+not+magic.'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $2
   18     7    >   INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   19    10      > RETURN                                                   null

End of function test

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.1 ms | 1400 KiB | 15 Q