3v4l.org

run code in 300+ PHP versions simultaneously
<?php $yourArray = [ ['item1' => 80], ['item2' => 25], ['item3' => 85], ]; function cmp($a, $b) { $a = reset($a); // get the first array elements $b = reset($b); // for comparison. if ($a == $b) { return 0; } return ($a < $b) ? -1 : 1; } usort($yourArray, "cmp"); print_r($yourArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PPNKR
function name:  (null)
number of ops:  9
compiled vars:  !0 = $yourArray
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   20     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'cmp'
          4        DO_ICALL                                                 
   22     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 13
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PPNKR
function name:  cmp
number of ops:  20
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     2        INIT_FCALL                                               'reset'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                         $2      
          5        ASSIGN                                                   !0, $2
   13     6        INIT_FCALL                                               'reset'
          7        SEND_REF                                                 !1
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !1, $4
   14    10        IS_EQUAL                                                 !0, !1
         11      > JMPZ                                                     ~6, ->13
   15    12    > > RETURN                                                   0
   17    13    >   IS_SMALLER                                               !0, !1
         14      > JMPZ                                                     ~7, ->17
         15    >   QM_ASSIGN                                        ~8      -1
         16      > JMP                                                      ->18
         17    >   QM_ASSIGN                                        ~8      1
         18    > > RETURN                                                   ~8
   18    19*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.51 ms | 1005 KiB | 16 Q