3v4l.org

run code in 300+ PHP versions simultaneously
<?php $indexes = [ 26 => ["namespace" => "X\\Y\\Zed"], 9 => ["namespace" => "A\\B\\See"], 3 => ["namespace" => "A\\B\\Bee"], 38 => ["namespace" => "A\\B\\C\\Dee"], 51 => ["namespace" => "X\\Wye"], 16 => ["namespace" => "A\\Sea"], 12 => ["namespace" => "A\\Bees"], ]; uasort($indexes, static function (array $entry1, array $entry2): int { $ns1Parts = explode('\\', $entry1['namespace']); $ns2Parts = explode('\\', $entry2['namespace']); $ns1Length = count($ns1Parts); $ns2Length = count($ns2Parts); for ($i = 0; $i < $ns1Length && isset($ns2Parts[$i]); $i++) { $isLastPartForNs1 = $i === $ns1Length - 1; $isLastPartForNs2 = $i === $ns2Length - 1; if ($isLastPartForNs1 !== $isLastPartForNs2) { return $isLastPartForNs1 <=> $isLastPartForNs2; } $nsComparison = $ns1Parts[$i] <=> $ns2Parts[$i]; if ($nsComparison !== 0) { return $nsComparison; } } return 0; }); print_r($indexes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/oIeWd
function name:  (null)
number of ops:  10
compiled vars:  !0 = $indexes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   36     4        SEND_VAL                                                 ~2
   13     5        DO_ICALL                                                 
   38     6        INIT_FCALL                                               'print_r'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 20
Branch analysis from position: 45
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 28, Position 2 = 31
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 39
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
2 jumps found. (Code = 46) Position 1 = 42, Position 2 = 44
Branch analysis from position: 42
Branch analysis from position: 44
Branch analysis from position: 44
filename:       /in/oIeWd
function name:  {closure}
number of ops:  48
compiled vars:  !0 = $entry1, !1 = $entry2, !2 = $ns1Parts, !3 = $ns2Parts, !4 = $ns1Length, !5 = $ns2Length, !6 = $i, !7 = $isLastPartForNs1, !8 = $isLastPartForNs2, !9 = $nsComparison
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'explode'
          3        SEND_VAL                                                 '%5C'
          4        FETCH_DIM_R                                      ~10     !0, 'namespace'
          5        SEND_VAL                                                 ~10
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !2, $11
   15     8        INIT_FCALL                                               'explode'
          9        SEND_VAL                                                 '%5C'
         10        FETCH_DIM_R                                      ~13     !1, 'namespace'
         11        SEND_VAL                                                 ~13
         12        DO_ICALL                                         $14     
         13        ASSIGN                                                   !3, $14
   17    14        COUNT                                            ~16     !2
         15        ASSIGN                                                   !4, ~16
   18    16        COUNT                                            ~18     !3
         17        ASSIGN                                                   !5, ~18
   20    18        ASSIGN                                                   !6, 0
         19      > JMP                                                      ->40
   21    20    >   SUB                                              ~21     !4, 1
         21        IS_IDENTICAL                                     ~22     !6, ~21
         22        ASSIGN                                                   !7, ~22
   22    23        SUB                                              ~24     !5, 1
         24        IS_IDENTICAL                                     ~25     !6, ~24
         25        ASSIGN                                                   !8, ~25
   24    26        IS_NOT_IDENTICAL                                         !7, !8
         27      > JMPZ                                                     ~27, ->31
   25    28    >   SPACESHIP                                        ~28     !7, !8
         29        VERIFY_RETURN_TYPE                                       ~28
         30      > RETURN                                                   ~28
   28    31    >   FETCH_DIM_R                                      ~29     !2, !6
         32        FETCH_DIM_R                                      ~30     !3, !6
         33        SPACESHIP                                        ~31     ~29, ~30
         34        ASSIGN                                                   !9, ~31
   30    35        IS_NOT_IDENTICAL                                         !9, 0
         36      > JMPZ                                                     ~33, ->39
   31    37    >   VERIFY_RETURN_TYPE                                       !9
         38      > RETURN                                                   !9
   20    39    >   PRE_INC                                                  !6
         40    >   IS_SMALLER                                       ~35     !6, !4
         41      > JMPZ_EX                                          ~35     ~35, ->44
         42    >   ISSET_ISEMPTY_DIM_OBJ                         0  ~36     !3, !6
         43        BOOL                                             ~35     ~36
         44    > > JMPNZ                                                    ~35, ->20
   35    45    > > RETURN                                                   0
   36    46*       VERIFY_RETURN_TYPE                                       
         47*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.89 ms | 1007 KiB | 16 Q