3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "SomeTitle" => [ 2018 => [ "February" => [], "January" => [], "March" => [] ], 2017 => [ "February" => [], "January" => [], "March" => [], "September" => [], "June" => [], "December" => [], "October" => [], "July" => [], "April" => [], "August" => [], "May" => [], ] ] ]; $lookup = array_flip( ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] ); foreach ($array as &$years) { krsort($years); foreach ($years as &$months) { uksort($months, fn($a, $b) => $lookup[$a] <=> $lookup[$b]); } } var_export($array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 125) Position 1 = 6, Position 2 = 21
Branch analysis from position: 6
2 jumps found. (Code = 126) Position 1 = 7, Position 2 = 21
Branch analysis from position: 7
2 jumps found. (Code = 125) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 126) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 19
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/lNc1e
function name:  (null)
number of ops:  26
compiled vars:  !0 = $array, !1 = $lookup, !2 = $years, !3 = $months
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   26     1        INIT_FCALL                                               'array_flip'
   27     2        SEND_VAL                                                 <array>
   26     3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   29     5      > FE_RESET_RW                                      $7      !0, ->21
          6    > > FE_FETCH_RW                                              $7, !2, ->21
   30     7    >   INIT_FCALL                                               'krsort'
          8        SEND_REF                                                 !2
          9        DO_ICALL                                                 
   31    10      > FE_RESET_RW                                      $9      !2, ->19
         11    > > FE_FETCH_RW                                              $9, !3, ->19
   32    12    >   INIT_FCALL                                               'uksort'
         13        SEND_REF                                                 !3
         14        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         15        BIND_LEXICAL                                             ~10, !1
         16        SEND_VAL                                                 ~10
         17        DO_ICALL                                                 
   31    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $9
   29    20      > JMP                                                      ->6
         21    >   FE_FREE                                                  $7
   35    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !0
         24        DO_ICALL                                                 
         25      > 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/lNc1e
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !2, !0
          4        FETCH_DIM_R                                      ~4      !2, !1
          5        SPACESHIP                                        ~5      ~3, ~4
          6      > RETURN                                                   ~5
          7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.68 ms | 1018 KiB | 17 Q