3v4l.org

run code in 300+ PHP versions simultaneously
<?php $acceleration = array(); $acceleration[0]= array("name"=>"60 to 90 in 6", "timing"=>4.7 ); $acceleration[1]= array("name"=>"40 to 120 in KD", "timing"=>3.3 ); $acceleration[2]= array("name"=>"60 to 100 in 4", "timing"=>1.5 ); $acceleration[3]= array("name"=>"60 to 90 in 4", "timing"=>2.4 ); $acceleration[4]= array("name"=>"140 to 160 in 6", "timing"=>2.4 ); $acceleration[5]= array("name"=>"60 to 90 in KD", "timing"=>5.7 ); function comp_maker( $key ) { return function ($a, $b) use ( $key ) { // closure for uasort to invoke return strnatcmp( $a[$key], $b[$key] ); // comp by "natural order" }; } uasort($acceleration, comp_maker( 'name' ) ); $str = ''; foreach ( $acceleration as $key => $value ){ $str .= ", $key"; } echo substr($str,1);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 22, Position 2 = 28
Branch analysis from position: 22
2 jumps found. (Code = 78) Position 1 = 23, Position 2 = 28
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/JnRYY
function name:  (null)
number of ops:  35
compiled vars:  !0 = $acceleration, !1 = $str, !2 = $value, !3 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 0
          2        OP_DATA                                                  <array>
    5     3        ASSIGN_DIM                                               !0, 1
          4        OP_DATA                                                  <array>
    6     5        ASSIGN_DIM                                               !0, 2
          6        OP_DATA                                                  <array>
    7     7        ASSIGN_DIM                                               !0, 3
          8        OP_DATA                                                  <array>
    8     9        ASSIGN_DIM                                               !0, 4
         10        OP_DATA                                                  <array>
    9    11        ASSIGN_DIM                                               !0, 5
         12        OP_DATA                                                  <array>
   18    13        INIT_FCALL                                               'uasort'
         14        SEND_REF                                                 !0
         15        INIT_FCALL                                               'comp_maker'
         16        SEND_VAL                                                 'name'
         17        DO_FCALL                                      0  $11     
         18        SEND_VAR                                                 $11
         19        DO_ICALL                                                 
   19    20        ASSIGN                                                   !1, ''
   20    21      > FE_RESET_R                                       $14     !0, ->28
         22    > > FE_FETCH_R                                       ~15     $14, !2, ->28
         23    >   ASSIGN                                                   !3, ~15
   21    24        NOP                                                      
         25        FAST_CONCAT                                      ~17     '%2C+', !3
         26        ASSIGN_OP                                     8          !1, ~17
   20    27      > JMP                                                      ->22
         28    >   FE_FREE                                                  $14
   23    29        INIT_FCALL                                               'substr'
         30        SEND_VAR                                                 !1
         31        SEND_VAL                                                 1
         32        DO_ICALL                                         $19     
         33        ECHO                                                     $19
         34      > RETURN                                                   1

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

End of function comp_maker

Function %00%7Bclosure%7D%2Fin%2FJnRYY%3A13%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JnRYY
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $a, !1 = $b, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   14     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
   15    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FJnRYY%3A13%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
175.09 ms | 1407 KiB | 20 Q