3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arrOne = [1, 3, 4]; $arrTwo = [2, 5]; $newArr = []; foreach($arrOne as $key => $one) { switch($key) { case 1: $newArr[] = $arrTwo[0]; break; case 4: $newArr[] = $arrTwo[1]; break; } $newArr[] = $one; } if(count($newArr, 1) < 5) { $newArr[] = $arrTwo[1]; } print_r($newArr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 22
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 29, Position 2 = 32
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
Branch analysis from position: 22
filename:       /in/9je5o
function name:  (null)
number of ops:  36
compiled vars:  !0 = $arrOne, !1 = $arrTwo, !2 = $newArr, !3 = $one, !4 = $key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    4     1        ASSIGN                                                       !1, <array>
    5     2        ASSIGN                                                       !2, <array>
    6     3      > FE_RESET_R                                           $8      !0, ->22
          4    > > FE_FETCH_R                                           ~9      $8, !3, ->22
          5    >   ASSIGN                                                       !4, ~9
    8     6        IS_EQUAL                                                     !4, 1
          7      > JMPNZ                                                        ~11, ->11
   11     8    >   IS_EQUAL                                                     !4, 4
          9      > JMPNZ                                                        ~11, ->15
         10    > > JMP                                                          ->19
    9    11    >   FETCH_DIM_R                                          ~13     !1, 0
         12        ASSIGN_DIM                                                   !2
         13        OP_DATA                                                      ~13
   10    14      > JMP                                                          ->19
   12    15    >   FETCH_DIM_R                                          ~15     !1, 1
         16        ASSIGN_DIM                                                   !2
         17        OP_DATA                                                      ~15
   13    18      > JMP                                                          ->19
   15    19    >   ASSIGN_DIM                                                   !2
         20        OP_DATA                                                      !3
    6    21      > JMP                                                          ->4
         22    >   FE_FREE                                                      $8
   17    23        INIT_FCALL                                                   'count'
         24        SEND_VAR                                                     !2
         25        SEND_VAL                                                     1
         26        DO_ICALL                                             $17     
         27        IS_SMALLER                                                   $17, 5
         28      > JMPZ                                                         ~18, ->32
   18    29    >   FETCH_DIM_R                                          ~20     !1, 1
         30        ASSIGN_DIM                                                   !2
         31        OP_DATA                                                      ~20
   21    32    >   INIT_FCALL                                                   'print_r'
         33        SEND_VAR                                                     !2
         34        DO_ICALL                                                     
         35      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
170.66 ms | 1908 KiB | 15 Q