3v4l.org

run code in 300+ PHP versions simultaneously
<?php $x=['a','b']; echo "Original\n\n"; for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; if($i == 0 ){ $test1 = $target_path; } if($i == 1 ){ $test2 = $target_path; } //This part should output only 2 results but it outputs something different. echo $test1." img 1 <br>"; echo $test2." img 2 <br>"; } echo "Rishi\n\n"; $target_path_arr = array(); for ($i = 0; $i < count($x); $i++) { $target_path = $x[$i]; $target_path_arr[] = $target_path; // use this in future echo $target_path." img ".($i+1)."<br>"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 4
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 34
Branch analysis from position: 34
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 24
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 37, Position 2 = 24
Branch analysis from position: 37
Branch analysis from position: 24
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 9
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 12
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 20, Position 2 = 4
Branch analysis from position: 20
Branch analysis from position: 4
Branch analysis from position: 12
Branch analysis from position: 9
filename:       /in/nZi0f
function name:  (null)
number of ops:  38
compiled vars:  !0 = $x, !1 = $i, !2 = $target_path, !3 = $test1, !4 = $test2, !5 = $target_path_arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ECHO                                                     'Original%0A%0A'
    4     2        ASSIGN                                                   !1, 0
          3      > JMP                                                      ->17
    5     4    >   FETCH_DIM_R                                      ~8      !0, !1
          5        ASSIGN                                                   !2, ~8
    7     6        IS_EQUAL                                                 !1, 0
          7      > JMPZ                                                     ~10, ->9
    8     8    >   ASSIGN                                                   !3, !2
   11     9    >   IS_EQUAL                                                 !1, 1
         10      > JMPZ                                                     ~12, ->12
   12    11    >   ASSIGN                                                   !4, !2
   16    12    >   CONCAT                                           ~14     !3, '+img+1+%3Cbr%3E'
         13        ECHO                                                     ~14
   18    14        CONCAT                                           ~15     !4, '+img+2+%3Cbr%3E'
         15        ECHO                                                     ~15
    4    16        PRE_INC                                                  !1
         17    >   COUNT                                            ~17     !0
         18        IS_SMALLER                                               !1, ~17
         19      > JMPNZ                                                    ~18, ->4
   20    20    >   ECHO                                                     'Rishi%0A%0A'
   21    21        ASSIGN                                                   !5, <array>
   22    22        ASSIGN                                                   !1, 0
         23      > JMP                                                      ->34
   23    24    >   FETCH_DIM_R                                      ~21     !0, !1
         25        ASSIGN                                                   !2, ~21
   24    26        ASSIGN_DIM                                               !5
         27        OP_DATA                                                  !2
   25    28        CONCAT                                           ~24     !2, '+img+'
         29        ADD                                              ~25     !1, 1
         30        CONCAT                                           ~26     ~24, ~25
         31        CONCAT                                           ~27     ~26, '%3Cbr%3E'
         32        ECHO                                                     ~27
   22    33        PRE_INC                                                  !1
         34    >   COUNT                                            ~29     !0
         35        IS_SMALLER                                               !1, ~29
         36      > JMPNZ                                                    ~30, ->24
   26    37    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.81 ms | 1399 KiB | 13 Q