3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = [ 'children' => [ 'a.class-1.php' => [], 'a' => [], 'a-1.class-1' => [], 'a.class.php' => [], 'a.class' => [], 'a-1.class-1.php-1' => [], 'a-1.class.php' => [], 'a-1' => [], 'a.class-1.php-1' => [], 'a.class.php-1' => [], ] ]; uksort($arr['children'], function($a, $b){ $a = explode('.', $a); $b = explode('.', $b); $s = ''; $i = 0; while (isset($a[$i]) && isset($b[$i]) && $a[$i] == $b[$i]) { $s .= $a[$i++] . '.'; } return $s . ($a[$i] ?? '') <=> $s . ($b[$i] ?? ''); }); print_r(array_keys($arr['children']));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/T8oOS
function name:  (null)
number of ops:  15
compiled vars:  !0 = $arr
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   18     1        INIT_FCALL                                                   'uksort'
          2        FETCH_DIM_W                                          $2      !0, 'children'
          3        SEND_REF                                                     $2
          4        DECLARE_LAMBDA_FUNCTION                              ~3      [0]
   27     5        SEND_VAL                                                     ~3
   18     6        DO_ICALL                                                     
   29     7        INIT_FCALL                                                   'print_r'
          8        INIT_FCALL                                                   'array_keys'
          9        FETCH_DIM_R                                          ~5      !0, 'children'
         10        SEND_VAL                                                     ~5
         11        DO_ICALL                                             $6      
         12        SEND_VAR                                                     $6
         13        DO_ICALL                                                     
         14      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
2 jumps found. (Code = 46) Position 1 = 24, Position 2 = 28
Branch analysis from position: 24
2 jumps found. (Code = 44) Position 1 = 29, Position 2 = 15
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 21, Position 2 = 23
Branch analysis from position: 21
Branch analysis from position: 23
Branch analysis from position: 28
Branch analysis from position: 23
filename:       /in/T8oOS
function name:  {closure:/in/T8oOS:18}
number of ops:  40
compiled vars:  !0 = $a, !1 = $b, !2 = $s, !3 = $i
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   18     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
   19     2        INIT_FCALL                                                   'explode'
          3        SEND_VAL                                                     '.'
          4        SEND_VAR                                                     !0
          5        DO_ICALL                                             $4      
          6        ASSIGN                                                       !0, $4
   20     7        INIT_FCALL                                                   'explode'
          8        SEND_VAL                                                     '.'
          9        SEND_VAR                                                     !1
         10        DO_ICALL                                             $6      
         11        ASSIGN                                                       !1, $6
   21    12        ASSIGN                                                       !2, ''
   22    13        ASSIGN                                                       !3, 0
   23    14      > JMP                                                          ->19
   24    15    >   POST_INC                                             ~10     !3
         16        FETCH_DIM_R                                          ~11     !0, ~10
         17        CONCAT                                               ~12     ~11, '.'
         18        ASSIGN_OP                                         8          !2, ~12
   23    19    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~14     !0, !3
         20      > JMPZ_EX                                              ~14     ~14, ->23
         21    >   ISSET_ISEMPTY_DIM_OBJ                             0  ~15     !1, !3
         22        BOOL                                                 ~14     ~15
         23    > > JMPZ_EX                                              ~14     ~14, ->28
         24    >   FETCH_DIM_R                                          ~16     !0, !3
         25        FETCH_DIM_R                                          ~17     !1, !3
         26        IS_EQUAL                                             ~18     ~16, ~17
         27        BOOL                                                 ~14     ~18
         28    > > JMPNZ                                                        ~14, ->15
   26    29    >   FETCH_DIM_IS                                         ~19     !0, !3
         30        COALESCE                                             ~20     ~19
         31        QM_ASSIGN                                            ~20     ''
         32        CONCAT                                               ~21     !2, ~20
         33        FETCH_DIM_IS                                         ~22     !1, !3
         34        COALESCE                                             ~23     ~22
         35        QM_ASSIGN                                            ~23     ''
         36        CONCAT                                               ~24     !2, ~23
         37        SPACESHIP                                            ~25     ~21, ~24
         38      > RETURN                                                       ~25
   27    39*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.81 ms | 1553 KiB | 17 Q