3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = array(array(0),array(1),array(2),array(3),array(4)); foreach ($a as $k => &$v) { echo $k .' => ' . json_encode($v) . PHP_EOL; $i = 0; // for ($i = 0; $i < 2; $i++) { $new = $v; $new[] = $i; array_push($a, $new); // } echo $k .' => ' . json_encode($v) . PHP_EOL; } var_dump($a);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 2, Position 2 = 27
Branch analysis from position: 2
2 jumps found. (Code = 126) Position 1 = 3, Position 2 = 27
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
filename:       /in/Z9fG5
function name:  (null)
number of ops:  32
compiled vars:  !0 = $a, !1 = $v, !2 = $k, !3 = $i, !4 = $new
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1      > FE_RESET_RW                                      $6      !0, ->27
          2    > > FE_FETCH_RW                                      ~7      $6, !1, ->27
          3    >   ASSIGN                                                   !2, ~7
    6     4        CONCAT                                           ~9      !2, '+%3D%3E+'
          5        INIT_FCALL                                               'json_encode'
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $10     
          8        CONCAT                                           ~11     ~9, $10
          9        CONCAT                                           ~12     ~11, '%0A'
         10        ECHO                                                     ~12
    8    11        ASSIGN                                                   !3, 0
   10    12        ASSIGN                                                   !4, !1
   11    13        ASSIGN_DIM                                               !4
         14        OP_DATA                                                  !3
   12    15        INIT_FCALL                                               'array_push'
         16        SEND_REF                                                 !0
         17        SEND_VAR                                                 !4
         18        DO_ICALL                                                 
   15    19        CONCAT                                           ~17     !2, '+%3D%3E+'
         20        INIT_FCALL                                               'json_encode'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                         $18     
         23        CONCAT                                           ~19     ~17, $18
         24        CONCAT                                           ~20     ~19, '%0A'
         25        ECHO                                                     ~20
    5    26      > JMP                                                      ->2
         27    >   FE_FREE                                                  $6
   18    28        INIT_FCALL                                               'var_dump'
         29        SEND_VAR                                                 !0
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.9 ms | 1396 KiB | 19 Q