3v4l.org

run code in 300+ PHP versions simultaneously
<?php $subjectSlots = [ "tamil" => [1, 2, 3, 4, 5], "english" => [4, 5, 6], "maths" => [1, 5, 8], "social" => [1, 2, 5], "pt" => [1], "hindi" => [3, 4, 7] ]; $requiredSubjects = ['tamil', 'tamil', 'pt', 'maths', 'maths', 'social', 'hindi', 'english']; usort($requiredSubjects, function($a, $b) use ($subjectSlots) { return $subjectSlots[$a] <=> $subjectSlots[$b]; }); var_export($requiredSubjects);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EKEaN
function name:  (null)
number of ops:  12
compiled vars:  !0 = $subjectSlots, !1 = $requiredSubjects
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   13     2        INIT_FCALL                                               'usort'
          3        SEND_REF                                                 !1
          4        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          5        BIND_LEXICAL                                             ~4, !0
   15     6        SEND_VAL                                                 ~4
   13     7        DO_ICALL                                                 
   17     8        INIT_FCALL                                               'var_export'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                                 
         11      > 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/EKEaN
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $subjectSlots
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   14     3        FETCH_DIM_R                                      ~3      !2, !0
          4        FETCH_DIM_R                                      ~4      !2, !1
          5        SPACESHIP                                        ~5      ~3, ~4
          6      > RETURN                                                   ~5
   15     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
314.79 ms | 1014 KiB | 15 Q