3v4l.org

run code in 300+ PHP versions simultaneously
<?php $color_ids = [ 'green' => [1, 2, 3], 'blue' => [4, 5], 'red' => [6], 'pink' => [7, 8, 9], 'yellow' => [10] ]; $select = ['green', 'red', 'yellow']; $result = []; foreach ($select as $color) { array_push($result, ...$color_ids[$color]); } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 12
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 12
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
filename:       /in/ZAsVi
function name:  (null)
number of ops:  17
compiled vars:  !0 = $color_ids, !1 = $select, !2 = $result, !3 = $color
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   13     2        ASSIGN                                                   !2, <array>
   14     3      > FE_RESET_R                                       $7      !1, ->12
          4    > > FE_FETCH_R                                               $7, !3, ->12
   15     5    >   INIT_FCALL                                               'array_push'
          6        SEND_REF                                                 !2
          7        FETCH_DIM_R                                      ~8      !0, !3
          8        SEND_UNPACK                                              ~8
          9        CHECK_UNDEF_ARGS                                         
         10        DO_ICALL                                                 
   14    11      > JMP                                                      ->4
         12    >   FE_FREE                                                  $7
   18    13        INIT_FCALL                                               'var_export'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.45 ms | 1002 KiB | 15 Q