3v4l.org

run code in 300+ PHP versions simultaneously
<?php $abc = array( array('f_name'=>'Aron','m_i'=>'M'), array('f_name'=>'Abbey','m_i'=>'D'), array('f_name'=>'Alice','m_i'=>'P')); function build_sorter($key) { return function ($a, $b) use ($key) { return strnatcmp($a[$key], $b[$key]); }; } usort($abc, build_sorter('f_name')); foreach ($array as $item) { echo $item['f_name'] . ', ' . $item['m_i'] . "\n"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 9, Position 2 = 17
Branch analysis from position: 9
2 jumps found. (Code = 78) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/Y9suG
function name:  (null)
number of ops:  19
compiled vars:  !0 = $abc, !1 = $array, !2 = $item
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        INIT_FCALL                                               'build_sorter'
          4        SEND_VAL                                                 'f_name'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   15     8      > FE_RESET_R                                       $6      !1, ->17
          9    > > FE_FETCH_R                                               $6, !2, ->17
   16    10    >   FETCH_DIM_R                                      ~7      !2, 'f_name'
         11        CONCAT                                           ~8      ~7, '%2C+'
         12        FETCH_DIM_R                                      ~9      !2, 'm_i'
         13        CONCAT                                           ~10     ~8, ~9
         14        CONCAT                                           ~11     ~10, '%0A'
         15        ECHO                                                     ~11
   15    16      > JMP                                                      ->9
         17    >   FE_FREE                                                  $6
   17    18      > RETURN                                                   1

Function build_sorter:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y9suG
function name:  build_sorter
number of ops:  5
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FY9suG%3A8%240'
          2        BIND_LEXICAL                                             ~1, !0
   10     3      > RETURN                                                   ~1
   11     4*     > RETURN                                                   null

End of function build_sorter

Function %00%7Bclosure%7D%2Fin%2FY9suG%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Y9suG
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    9     3        INIT_FCALL                                               'strnatcmp'
          4        FETCH_DIM_R                                      ~3      !0, !2
          5        SEND_VAL                                                 ~3
          6        FETCH_DIM_R                                      ~4      !1, !2
          7        SEND_VAL                                                 ~4
          8        DO_ICALL                                         $5      
          9      > RETURN                                                   $5
   10    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FY9suG%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.35 ms | 1403 KiB | 18 Q