3v4l.org

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

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

End of function __construct

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
173.31 ms | 1400 KiB | 15 Q