3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ['Jay', 'Jay', 'Jay', 'Spiders', 'Dogs', 'Cats', 'John', 'John', 'John', 'Dogs', 'Cows', 'Snakes']; $new = array( array_shift( $array)); foreach( $array as $el) { if( !($array[count($array) - 1] === $el)) { $array[] = $el; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 17
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 16
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/jRNCs
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $new, !2 = $el
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        INIT_FCALL                                               'array_shift'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                         $4      
          4        INIT_ARRAY                                       ~5      $4
          5        ASSIGN                                                   !1, ~5
    4     6      > FE_RESET_R                                       $7      !0, ->17
          7    > > FE_FETCH_R                                               $7, !2, ->17
    5     8    >   COUNT                                            ~8      !0
          9        SUB                                              ~9      ~8, 1
         10        FETCH_DIM_R                                      ~10     !0, ~9
         11        IS_IDENTICAL                                     ~11     !2, ~10
         12        BOOL_NOT                                         ~12     ~11
         13      > JMPZ                                                     ~12, ->16
    6    14    >   ASSIGN_DIM                                               !0
         15        OP_DATA                                                  !2
    4    16    > > JMP                                                      ->7
         17    >   FE_FREE                                                  $7
    8    18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.43 ms | 1395 KiB | 15 Q