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 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 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 17
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 17
2 jumps found. (Code = 77) Position 1 = 21, Position 2 = 27
Branch analysis from position: 21
2 jumps found. (Code = 78) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 37
Branch analysis from position: 48
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 37
Branch analysis from position: 48
Branch analysis from position: 37
Branch analysis from position: 27
Branch analysis from position: 17
filename:       /in/JKl8X
function name:  (null)
number of ops:  49
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        NEW                                              $8      'ArrayObject'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ECHO                                                     $8
   16     9        ECHO                                                     'obj%0A'
   17    10      > FE_RESET_R                                       $10     !0, ->17
         11    > > FE_FETCH_R                                               $10, !1, ->17
   18    12    >   ASSIGN_OBJ                                               !0, 'y'
         13        OP_DATA                                                  '500'
   19    14        CONCAT                                           ~12     !1, '%0A'
         15        ECHO                                                     ~12
   17    16      > JMP                                                      ->11
         17    >   FE_FREE                                                  $10
   22    18        ECHO                                                     'arr%0A'
   23    19        ASSIGN                                                   !2, <array>
   24    20      > FE_RESET_R                                       $14     !2, ->27
         21    > > FE_FETCH_R                                               $14, !1, ->27
   25    22    >   ASSIGN_DIM                                               !2, 1
         23        OP_DATA                                                  500
   26    24        CONCAT                                           ~16     !1, '%0A'
         25        ECHO                                                     ~16
   24    26      > JMP                                                      ->21
         27    >   FE_FREE                                                  $14
   29    28        ECHO                                                     'arr_iter%0A'
   30    29        ASSIGN                                                   !3, <array>
   31    30        NEW                                              $18     'ArrayIterator'
         31        SEND_VAR_EX                                              !3
         32        DO_FCALL                                      0          
         33        ASSIGN                                                   !4, $18
   32    34        INIT_METHOD_CALL                                         !4, 'rewind'
         35        DO_FCALL                                      0          
   33    36      > JMP                                                      ->45
   34    37    >   ASSIGN_DIM                                               !3, 1
         38        OP_DATA                                                  500
   35    39        INIT_METHOD_CALL                                         !4, 'current'
         40        DO_FCALL                                      0  $23     
         41        CONCAT                                           ~24     $23, '%0A'
         42        ECHO                                                     ~24
   36    43        INIT_METHOD_CALL                                         !4, 'next'
         44        DO_FCALL                                      0          
   33    45    >   INIT_METHOD_CALL                                         !4, 'valid'
         46        DO_FCALL                                      0  $26     
         47      > JMPNZ                                                    $26, ->37
   38    48    > > RETURN                                                   1

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JKl8X
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:
169.85 ms | 1399 KiB | 13 Q