3v4l.org

run code in 300+ PHP versions simultaneously
<?php $priority = [ "a" => "AAA", "b" => "AA", "c" => "A", "d" => "BBB", "e" => "BB", "f" => "B", "g" => "CCC", "h" => "CC", "i" => "C" ]; $ratingHistory = [ "BB", "B", "CCC", "C", "BB" ]; $lookup = array_flip($priority); usort($ratingHistory, fn($a, $b) => $lookup[$a] <=> $lookup[$b]); var_export([ 'min' => $ratingHistory[0], 'max' => $ratingHistory[array_key_last($ratingHistory)] ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0ttQ
function name:  (null)
number of ops:  23
compiled vars:  !0 = $priority, !1 = $ratingHistory, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   22     2        INIT_FCALL                                               'array_flip'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !2, $5
   23     6        INIT_FCALL                                               'usort'
          7        SEND_REF                                                 !1
          8        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fr0ttQ%3A23%240'
          9        BIND_LEXICAL                                             ~7, !2
         10        SEND_VAL                                                 ~7
         11        DO_ICALL                                                 
   24    12        INIT_FCALL                                               'var_export'
   25    13        FETCH_DIM_R                                      ~9      !1, 0
         14        INIT_ARRAY                                       ~10     ~9, 'min'
   26    15        INIT_FCALL                                               'array_key_last'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                         $11     
         18        FETCH_DIM_R                                      ~12     !1, $11
         19        ADD_ARRAY_ELEMENT                                ~10     ~12, 'max'
         20        SEND_VAL                                                 ~10
         21        DO_ICALL                                                 
   27    22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fr0ttQ%3A23%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/r0ttQ
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $lookup
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     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 function %00%7Bclosure%7D%2Fin%2Fr0ttQ%3A23%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.67 ms | 1401 KiB | 21 Q