3v4l.org

run code in 300+ PHP versions simultaneously
<?php $menuArray = [ 'Main Street' => [], 'Activities' => [], 'Services' => [], 'Account' => [] ]; $lookup = [ 0 => 'Main Street', 1 => 'Activities', 2 => 'Services', 3 => 'Account', 4 => 'Communication' ]; $customsort = '4,2,1,3,0'; $keys = array_flip(explode(',', $customsort)); var_export($keys); $ordered_keys = array_flip(array_replace($keys, $lookup)); var_export($ordered_keys); $filtered_keys = array_intersect_key($ordered_keys, $menuArray); var_export($filtered_keys); $final = array_replace($filtered_keys, $menuArray); var_export($final);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rkOGY
function name:  (null)
number of ops:  42
compiled vars:  !0 = $menuArray, !1 = $lookup, !2 = $customsort, !3 = $keys, !4 = $ordered_keys, !5 = $filtered_keys, !6 = $final
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
   16     2        ASSIGN                                                   !2, '4%2C2%2C1%2C3%2C0'
   18     3        INIT_FCALL                                               'array_flip'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '%2C'
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $10     
          8        SEND_VAR                                                 $10
          9        DO_ICALL                                         $11     
         10        ASSIGN                                                   !3, $11
   19    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !3
         13        DO_ICALL                                                 
   21    14        INIT_FCALL                                               'array_flip'
         15        INIT_FCALL                                               'array_replace'
         16        SEND_VAR                                                 !3
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $14     
         19        SEND_VAR                                                 $14
         20        DO_ICALL                                         $15     
         21        ASSIGN                                                   !4, $15
   22    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                                 
   23    25        INIT_FCALL                                               'array_intersect_key'
         26        SEND_VAR                                                 !4
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $18     
         29        ASSIGN                                                   !5, $18
   24    30        INIT_FCALL                                               'var_export'
         31        SEND_VAR                                                 !5
         32        DO_ICALL                                                 
   25    33        INIT_FCALL                                               'array_replace'
         34        SEND_VAR                                                 !5
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                         $21     
         37        ASSIGN                                                   !6, $21
   26    38        INIT_FCALL                                               'var_export'
         39        SEND_VAR                                                 !6
         40        DO_ICALL                                                 
         41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.94 ms | 1005 KiB | 18 Q