3v4l.org

run code in 300+ PHP versions simultaneously
<?php //No constructor class Foo {} $a = null; $f = new Foo($a = 123); var_dump($a); // NULL as expected //PHP 5 style constructor class Foo2 { function __construct(){} } $a = null; $f = new Foo2($a = 123); var_dump($a); // int(123) what???? // PHP 4 style constructor class Foo3 { function Foo3(){} } $a = null; $f = new Foo3($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/IFS07
function name:  (null)
number of ops:  28
compiled vars:  !0 = $a, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, null
    6     1        NEW                                              $3      'Foo'
          2        ASSIGN                                           ~4      !0, 123
          3        SEND_VAL_EX                                              ~4
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $3
    7     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   12     9        ASSIGN                                                   !0, null
   13    10        NEW                                              $9      'Foo2'
         11        ASSIGN                                           ~10     !0, 123
         12        SEND_VAL_EX                                              ~10
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !1, $9
   14    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   19    18        ASSIGN                                                   !0, null
   20    19        NEW                                              $15     'Foo3'
         20        ASSIGN                                           ~16     !0, 123
         21        SEND_VAL_EX                                              ~16
         22        DO_FCALL                                      0          
         23        ASSIGN                                                   !1, $15
   21    24        INIT_FCALL                                               'var_dump'
         25        SEND_VAR                                                 !0
         26        DO_ICALL                                                 
   22    27      > RETURN                                                   1

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

End of function __construct

End of class Foo2.

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

End of function foo3

End of class Foo3.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.75 ms | 1396 KiB | 15 Q