3v4l.org

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

Class Test1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4CeIN
function name:  __construct
number of ops:  7
compiled vars:  !0 = $z
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/4CeIN
function name:  __construct
number of ops:  7
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   15     1        PRE_INC                                                  !0
   16     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
   17     6      > RETURN                                                   null

End of function __construct

End of class Test2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.3 ms | 1400 KiB | 15 Q