3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} $a = null; $f = new Foo($a = 123); var_dump($a); // NULL as expected class Foo { function __construct(){} } $a = null; $f = new Foo($a = 123); var_dump($a); // int(123) what???? class Foo2 { function Foo2(){} } $a = null; $f = new Foo2($a = 123); var_dump($a); // int(123) what????
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXBo4
function name:  (null)
number of ops:  29
compiled vars:  !0 = $a, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, null
    4     1        NEW                                              $3      'Foo'
          2        ASSIGN                                           ~4      !0, 123
          3        SEND_VAL_EX                                              ~4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    5     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
    8     9        DECLARE_CLASS                                            'foo'
    9    10        ASSIGN                                                   !0, null
   10    11        NEW                                              $9      'Foo'
         12        ASSIGN                                           ~10     !0, 123
         13        SEND_VAL_EX                                              ~10
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $9
   11    16        INIT_FCALL                                               'var_dump'
         17        SEND_VAR                                                 !0
         18        DO_ICALL                                                 
   15    19        ASSIGN                                                   !0, null
   16    20        NEW                                              $15     'Foo2'
         21        ASSIGN                                           ~16     !0, 123
         22        SEND_VAL_EX                                              ~16
         23        DO_FCALL                                      0          
         24        ASSIGN                                                   !1, $15
   17    25        INIT_FCALL                                               'var_dump'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
   18    28      > RETURN                                                   1

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

End of function __construct

End of class Foo.

Class Foo2:
Function foo2:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/DXBo4
function name:  Foo2
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                   null

End of function foo2

End of class Foo2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.26 ms | 1396 KiB | 15 Q