3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 125 => '3110 - with a string', 128 => '3009 - keep a string', 126 => '3111 - a string', 121 => '3114 - be a string', 122 => '3113 - last string', ]; function cmp($a, $b) { return strcmp(trim(explode('-',$a)[1]) ,trim(explode('-',$b)[1])); } usort($array, "cmp"); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NEdmt
function name:  (null)
number of ops:  9
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'cmp'
          4        DO_ICALL                                                 
   20     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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NEdmt
function name:  cmp
number of ops:  24
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_FCALL                                               'strcmp'
          3        INIT_FCALL                                               'trim'
          4        INIT_FCALL                                               'explode'
          5        SEND_VAL                                                 '-'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $2      
          8        FETCH_DIM_R                                      ~3      $2, 1
          9        SEND_VAL                                                 ~3
         10        DO_ICALL                                         $4      
         11        SEND_VAR                                                 $4
         12        INIT_FCALL                                               'trim'
         13        INIT_FCALL                                               'explode'
         14        SEND_VAL                                                 '-'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $5      
         17        FETCH_DIM_R                                      ~6      $5, 1
         18        SEND_VAL                                                 ~6
         19        DO_ICALL                                         $7      
         20        SEND_VAR                                                 $7
         21        DO_ICALL                                         $8      
         22      > RETURN                                                   $8
   15    23*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.08 ms | 1007 KiB | 18 Q