3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array ( array ( 'cat_id' => 14, 'parent_id' => 2, 'cat_url_title' => '20-a-43m' ), array ( 'cat_id' => 13, 'parent_id' => 2, 'cat_url_title' => '16-a-20n' ), array ( 'cat_id' => 15, 'parent_id' => 3, 'cat_url_title' => '1-a-40m' ), array ( 'cat_id' => 13, 'parent_id' => 2, 'cat_url_title' => '16-a-20m' ), array ( 'cat_id' => 16, 'parent_id' => 3, 'cat_url_title' => '2-a-55m' ), array ( 'cat_id' => 13, 'parent_id' => 2, 'cat_url_title' => '16-b-1m' ), array ( 'cat_id' => 16, 'parent_id' => 2, 'cat_url_title' => '16-a-18m' ), array ( 'cat_id' => 12, 'parent_id' => 2, 'cat_url_title' => '12-a-16m' ) ); // array_multisort(array_column($array, 'cat_url_title'), SORT_NUMERIC, $array); /* usort($array, function($a, $b) { return (int)$a['cat_url_title'] <=> (int)$b['cat_url_title']; }); */ // usort($array, fn($a, $b) => (int)$a['cat_url_title'] <=> (int)$b['cat_url_title']); usort($array, function($a, $b) { return (preg_match_all('~[a-z]+|\d+~', $a['cat_url_title'], $out) ? $out[0] : ['','','','']) <=> (preg_match_all('~[a-z]+|\d+~', $b['cat_url_title'], $out) ? $out[0] : ['','','','']); }); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WGCfZ
function name:  (null)
number of ops:  10
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   55     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
   59     4        SEND_VAL                                                 ~2
   55     5        DO_ICALL                                                 
   61     6        INIT_FCALL                                               'var_export'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 12
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 12
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 23
Branch analysis from position: 20
Branch analysis from position: 23
filename:       /in/WGCfZ
function name:  {closure}
number of ops:  27
compiled vars:  !0 = $a, !1 = $b, !2 = $out
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   55     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   56     2        INIT_FCALL                                               'preg_match_all'
          3        SEND_VAL                                                 '%7E%5Ba-z%5D%2B%7C%5Cd%2B%7E'
          4        FETCH_DIM_R                                      ~3      !0, 'cat_url_title'
          5        SEND_VAL                                                 ~3
          6        SEND_REF                                                 !2
          7        DO_ICALL                                         $4      
          8      > JMPZ                                                     $4, ->12
          9    >   FETCH_DIM_R                                      ~5      !2, 0
         10        QM_ASSIGN                                        ~6      ~5
         11      > JMP                                                      ->13
         12    >   QM_ASSIGN                                        ~6      <array>
   58    13    >   INIT_FCALL                                               'preg_match_all'
         14        SEND_VAL                                                 '%7E%5Ba-z%5D%2B%7C%5Cd%2B%7E'
         15        FETCH_DIM_R                                      ~7      !1, 'cat_url_title'
         16        SEND_VAL                                                 ~7
         17        SEND_REF                                                 !2
         18        DO_ICALL                                         $8      
         19      > JMPZ                                                     $8, ->23
         20    >   FETCH_DIM_R                                      ~9      !2, 0
         21        QM_ASSIGN                                        ~10     ~9
         22      > JMP                                                      ->24
         23    >   QM_ASSIGN                                        ~10     <array>
         24    >   SPACESHIP                                        ~11     ~6, ~10
         25      > RETURN                                                   ~11
   59    26*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.23 ms | 1433 KiB | 16 Q