3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pages = [ 'a' => ['title' => 'A'], 'c' => ['title' => 'C'], 'b' => ['title' => 'B'], 'n' => ['title' => '.N'], ]; $keys = []; foreach ($pages as $p) { if (! isset($keys[$p['title']])) { $keys[$p['title']] = preg_replace('_^[^0-9a-z]*_', '', strtolower($p['title'])); } } uasort($pages, fn($a, $b) => $keys[$a['title']] <=> $keys[$b['title']]); echo implode(', ', array_map(fn($page) => $page['title'], $pages));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 21
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 21
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 20
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/E9i6C
function name:  (null)
number of ops:  39
compiled vars:  !0 = $pages, !1 = $keys, !2 = $p
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   10     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $5      !0, ->21
          3    > > FE_FETCH_R                                               $5, !2, ->21
   12     4    >   FETCH_DIM_R                                      ~6      !2, 'title'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      !1, ~6
          6        BOOL_NOT                                         ~8      ~7
          7      > JMPZ                                                     ~8, ->20
   13     8    >   FETCH_DIM_R                                      ~9      !2, 'title'
          9        INIT_FCALL                                               'preg_replace'
         10        SEND_VAL                                                 '_%5E%5B%5E0-9a-z%5D%2A_'
         11        SEND_VAL                                                 ''
         12        INIT_FCALL                                               'strtolower'
         13        FETCH_DIM_R                                      ~11     !2, 'title'
         14        SEND_VAL                                                 ~11
         15        DO_ICALL                                         $12     
         16        SEND_VAR                                                 $12
         17        DO_ICALL                                         $13     
         18        ASSIGN_DIM                                               !1, ~9
         19        OP_DATA                                                  $13
   11    20    > > JMP                                                      ->3
         21    >   FE_FREE                                                  $5
   17    22        INIT_FCALL                                               'uasort'
         23        SEND_REF                                                 !0
         24        DECLARE_LAMBDA_FUNCTION                          ~14     [0]
         25        BIND_LEXICAL                                             ~14, !1
         26        SEND_VAL                                                 ~14
         27        DO_ICALL                                                 
   19    28        INIT_FCALL                                               'implode'
         29        SEND_VAL                                                 '%2C+'
         30        INIT_FCALL                                               'array_map'
         31        DECLARE_LAMBDA_FUNCTION                          ~16     [1]
         32        SEND_VAL                                                 ~16
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                         $17     
         35        SEND_VAR                                                 $17
         36        DO_ICALL                                         $18     
         37        ECHO                                                     $18
         38      > 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/E9i6C
function name:  {closure}
number of ops:  10
compiled vars:  !0 = $a, !1 = $b, !2 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        FETCH_DIM_R                                      ~3      !0, 'title'
          4        FETCH_DIM_R                                      ~4      !2, ~3
          5        FETCH_DIM_R                                      ~5      !1, 'title'
          6        FETCH_DIM_R                                      ~6      !2, ~5
          7        SPACESHIP                                        ~7      ~4, ~6
          8      > RETURN                                                   ~7
          9*     > RETURN                                                   null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/E9i6C
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $page
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'title'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of Dynamic Function 1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.57 ms | 1020 KiB | 18 Q