3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = [1, 2, 3, 4, 3, 2, 1]; $j = count($a) - 1; $output = []; for($i = 0; $i > count($a); $i++) { if ($a[i] !== $a[j]) { $output = $a[i]; } $j--; } print_r($output);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 7
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 16
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 21, Position 2 = 7
Branch analysis from position: 21
Branch analysis from position: 7
Branch analysis from position: 16
filename:       /in/bW9N3
function name:  (null)
number of ops:  25
compiled vars:  !0 = $a, !1 = $j, !2 = $output, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        COUNT                                            ~5      !0
          2        SUB                                              ~6      ~5, 1
          3        ASSIGN                                                   !1, ~6
    7     4        ASSIGN                                                   !2, <array>
    9     5        ASSIGN                                                   !3, 0
          6      > JMP                                                      ->18
   10     7    >   FETCH_CONSTANT                                   ~10     'i'
          8        FETCH_DIM_R                                      ~11     !0, ~10
          9        FETCH_CONSTANT                                   ~12     'j'
         10        FETCH_DIM_R                                      ~13     !0, ~12
         11        IS_NOT_IDENTICAL                                         ~11, ~13
         12      > JMPZ                                                     ~14, ->16
   11    13    >   FETCH_CONSTANT                                   ~15     'i'
         14        FETCH_DIM_R                                      ~16     !0, ~15
         15        ASSIGN                                                   !2, ~16
   14    16    >   PRE_DEC                                                  !1
    9    17        PRE_INC                                                  !3
         18    >   COUNT                                            ~20     !0
         19        IS_SMALLER                                               ~20, !3
         20      > JMPNZ                                                    ~21, ->7
   17    21    >   INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !2
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.83 ms | 1395 KiB | 15 Q