3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test1 { public function __construct(&$x){ ++$x; echo "You sent me $x\n"; } } $a = 8; $o = new Test1($b = $a); var_dump($b,$b == $GLOBALS['b']); class Test2 { public function __construct(&$x){ ++$x; echo "You sent me $x\n"; } } $a = 8; $o = new Test2($b = &$a); var_dump($b,$b == $GLOBALS['b']);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EA0qZ
function name:  (null)
number of ops:  27
compiled vars:  !0 = $a, !1 = $o, !2 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 8
    9     1        NEW                                              $4      'Test1'
          2        ASSIGN                                           ~5      !2, !0
          3        SEND_VAL_EX                                              ~5
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $4
   10     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !2
          8        FETCH_R                      global              ~8      'GLOBALS'
          9        FETCH_DIM_R                                      ~9      ~8, 'b'
         10        IS_EQUAL                                         ~10     !2, ~9
         11        SEND_VAL                                                 ~10
         12        DO_ICALL                                                 
   18    13        ASSIGN                                                   !0, 8
   19    14        NEW                                              $13     'Test2'
         15        ASSIGN_REF                                       $14     !2, !0
         16        SEND_VAR_NO_REF_EX                                       $14
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !1, $13
   20    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !2
         21        FETCH_R                      global              ~17     'GLOBALS'
         22        FETCH_DIM_R                                      ~18     ~17, 'b'
         23        IS_EQUAL                                         ~19     !2, ~18
         24        SEND_VAL                                                 ~19
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Class Test1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EA0qZ
function name:  __construct
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        PRE_INC                                                  !0
    5     2        ROPE_INIT                                     3  ~3      'You+sent+me+'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
    6     6      > RETURN                                                   null

End of function __construct

End of class Test1.

Class Test2:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EA0qZ
function name:  __construct
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        PRE_INC                                                  !0
   15     2        ROPE_INIT                                     3  ~3      'You+sent+me+'
          3        ROPE_ADD                                      1  ~3      ~3, !0
          4        ROPE_END                                      2  ~2      ~3, '%0A'
          5        ECHO                                                     ~2
   16     6      > RETURN                                                   null

End of function __construct

End of class Test2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.95 ms | 1400 KiB | 15 Q