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'); usort( $allOptions, fn($a, $b) => ($priority[$a['clID']] ?? PHP_INT_MAX) <=> ($priority[$b['clID']] ?? PHP_INT_MAX) ); var_export($allOptions);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/abW9q
function name:  (null)
number of ops:  18
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                                               'usort'
   27     9        SEND_REF                                                 !0
   28    10        DECLARE_LAMBDA_FUNCTION                          ~7      [0]
         11        BIND_LEXICAL                                             ~7, !2
   29    12        SEND_VAL                                                 ~7
   26    13        DO_ICALL                                                 
   30    14        INIT_FCALL                                               'var_export'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
         17      > 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/abW9q
function name:  {closure}
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $priority
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !0, 'clID'
          4        FETCH_DIM_IS                                     ~4      !2, ~3
          5        COALESCE                                         ~5      ~4
          6        QM_ASSIGN                                        ~5      9223372036854775807
          7        FETCH_DIM_R                                      ~6      !1, 'clID'
          8        FETCH_DIM_IS                                     ~7      !2, ~6
          9        COALESCE                                         ~8      ~7
         10        QM_ASSIGN                                        ~8      9223372036854775807
         11        SPACESHIP                                        ~9      ~5, ~8
         12      > RETURN                                                   ~9
   29    13*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.2 ms | 1001 KiB | 16 Q