3v4l.org

run code in 300+ PHP versions simultaneously
<?php $assoc_arr = array("second" => array( array("position" => 4, "content" => "Valiant"), array("position" => 5, "content" => "Hail") ), "first" => array( array("position" => 0, "content" => "Hail"), array("position" => 3, "content" => "Victors"), array("position" => 2, "content" => "the"), array("position" => 1, "content" => "to") ) ); $order = array('first','second'); $arr = array(); foreach($order as $ord) { if(isset($assoc_arr[$ord])) { $arr = array_merge($arr, $assoc_arr[$ord]); } } print_r($arr);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 13
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 13
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/ZUeuA
function name:  (null)
number of ops:  19
compiled vars:  !0 = $assoc_arr, !1 = $order, !2 = $arr, !3 = $ord
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   23     2        ASSIGN                                                   !2, <array>
   25     3      > FE_RESET_R                                       $7      !1, ->14
          4    > > FE_FETCH_R                                               $7, !3, ->14
   26     5    >   ISSET_ISEMPTY_DIM_OBJ                         0          !0, !3
          6      > JMPZ                                                     ~8, ->13
   27     7    >   INIT_FCALL                                               'array_merge'
          8        SEND_VAR                                                 !2
          9        FETCH_DIM_R                                      ~9      !0, !3
         10        SEND_VAL                                                 ~9
         11        DO_ICALL                                         $10     
         12        ASSIGN                                                   !2, $10
   25    13    > > JMP                                                      ->4
         14    >   FE_FREE                                                  $7
   31    15        INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !2
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.88 ms | 1395 KiB | 17 Q