3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $x; public $y; public function __construct($x, $y) { $this->x = $x; $this->y = $y; } } $a = new A(1, "42"); print var_dump(new ArrayObject($a)); print "obj\n"; foreach ($a as $v) { $a->y = "500"; print $v . "\n"; } print "arr\n"; $b = array(1, 2, 3); foreach($b as $v) { $b[1] = 500; print $v . "\n"; } print "arr_iter\n"; $c = array(1, 2, 3); $i = new ArrayIterator($c); $i->rewind(); while ($i->valid()) { $c[1] = 500; print $i->current() . "\n"; $i->next(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 20
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 20
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 20
2 jumps found. (Code = 77) Position 1 = 24, Position 2 = 30
Branch analysis from position: 24
2 jumps found. (Code = 78) Position 1 = 25, Position 2 = 30
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
Branch analysis from position: 30
1 jumps found. (Code = 42) Position 1 = 48
Branch analysis from position: 48
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 40
Branch analysis from position: 51
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
2 jumps found. (Code = 44) Position 1 = 51, Position 2 = 40
Branch analysis from position: 51
Branch analysis from position: 40
Branch analysis from position: 30
Branch analysis from position: 20
filename:       /in/hsQtX
function name:  (null)
number of ops:  52
compiled vars:  !0 = $a, !1 = $v, !2 = $b, !3 = $c, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $5      'A'
          1        SEND_VAL_EX                                              1
          2        SEND_VAL_EX                                              '42'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !0, $5
   14     5        INIT_FCALL                                               'var_dump'
          6        NEW                                              $8      'ArrayObject'
          7        SEND_VAR_EX                                              !0
          8        DO_FCALL                                      0          
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                         $10     
         11        ECHO                                                     $10
   16    12        ECHO                                                     'obj%0A'
   17    13      > FE_RESET_R                                       $11     !0, ->20
         14    > > FE_FETCH_R                                               $11, !1, ->20
   18    15    >   ASSIGN_OBJ                                               !0, 'y'
         16        OP_DATA                                                  '500'
   19    17        CONCAT                                           ~13     !1, '%0A'
         18        ECHO                                                     ~13
   17    19      > JMP                                                      ->14
         20    >   FE_FREE                                                  $11
   22    21        ECHO                                                     'arr%0A'
   23    22        ASSIGN                                                   !2, <array>
   24    23      > FE_RESET_R                                       $15     !2, ->30
         24    > > FE_FETCH_R                                               $15, !1, ->30
   25    25    >   ASSIGN_DIM                                               !2, 1
         26        OP_DATA                                                  500
   26    27        CONCAT                                           ~17     !1, '%0A'
         28        ECHO                                                     ~17
   24    29      > JMP                                                      ->24
         30    >   FE_FREE                                                  $15
   29    31        ECHO                                                     'arr_iter%0A'
   30    32        ASSIGN                                                   !3, <array>
   31    33        NEW                                              $19     'ArrayIterator'
         34        SEND_VAR_EX                                              !3
         35        DO_FCALL                                      0          
         36        ASSIGN                                                   !4, $19
   32    37        INIT_METHOD_CALL                                         !4, 'rewind'
         38        DO_FCALL                                      0          
   33    39      > JMP                                                      ->48
   34    40    >   ASSIGN_DIM                                               !3, 1
         41        OP_DATA                                                  500
   35    42        INIT_METHOD_CALL                                         !4, 'current'
         43        DO_FCALL                                      0  $24     
         44        CONCAT                                           ~25     $24, '%0A'
         45        ECHO                                                     ~25
   36    46        INIT_METHOD_CALL                                         !4, 'next'
         47        DO_FCALL                                      0          
   33    48    >   INIT_METHOD_CALL                                         !4, 'valid'
         49        DO_FCALL                                      0  $27     
         50      > JMPNZ                                                    $27, ->40
   38    51    > > RETURN                                                   1

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

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
204.01 ms | 1400 KiB | 15 Q