3v4l.org

run code in 300+ PHP versions simultaneously
<?php $allOptions = [ ["clID" => 171], ["clID" => 191], ["clID" => 131], ["clID" => 101], ["clID" => 201], ["clID" => 181], ["clID" => 99], // not in regOptions ["clID" => 129], // not in regOptions ["clID" => 139], ]; $regOptions = [ ["order" => 1, "optID" => 131], ["order" => 2, "optID" => 191], ["order" => 3, "optID" => 181], ["order" => 4, "optID" => 139], ["order" => 5, "optID" => 101], ["order" => 6, "optID" => 201], ["order" => 7, "optID" => 171], ]; $priority = array_column($regOptions, 'order', 'optID'); array_multisort( array_map(fn($v) => $priority[$v['clID']] ?? PHP_INT_MAX, $allOptions), $allOptions ); var_export($allOptions);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URhoB
function name:  (null)
number of ops:  22
compiled vars:  !0 = $allOptions, !1 = $regOptions, !2 = $priority
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        ASSIGN                                                   !1, <array>
   25     2        INIT_FCALL                                               'array_column'
          3        SEND_VAR                                                 !1
          4        SEND_VAL                                                 'order'
          5        SEND_VAL                                                 'optID'
          6        DO_ICALL                                         $5      
          7        ASSIGN                                                   !2, $5
   26     8        INIT_FCALL                                               'array_multisort'
   27     9        INIT_FCALL                                               'array_map'
         10        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         11        BIND_LEXICAL                                             ~7, !2
         12        SEND_VAL                                                 ~7
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $8      
         15        SEND_VAL                                                 $8
   28    16        SEND_REF                                                 !0
   26    17        DO_ICALL                                                 
   30    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !0
         20        DO_ICALL                                                 
         21      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/URhoB
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $v, !1 = $priority
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   27     0  E >   RECV                                             !0      
          1        BIND_STATIC                                              !1
          2        FETCH_DIM_R                                      ~2      !0, 'clID'
          3        FETCH_DIM_IS                                     ~3      !1, ~2
          4        COALESCE                                         ~4      ~3
          5        QM_ASSIGN                                        ~4      9223372036854775807
          6      > RETURN                                                   ~4
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.59 ms | 1002 KiB | 17 Q