3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("100_1", "100_2", "100_3", "100_11", "101_1", "102_1", "102_2", "103_1", "103_2", "103_3", "104_1", "104_2"); natsort($array); foreach($array as $value) { $parts = explode('_', $value); $result[$parts[0]] = $value; } $result = array_values($result); print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 15
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/MM41I
function name:  (null)
number of ops:  24
compiled vars:  !0 = $array, !1 = $value, !2 = $parts, !3 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'natsort'
          2        SEND_REF                                                 !0
          3        DO_ICALL                                                 
    7     4      > FE_RESET_R                                       $6      !0, ->15
          5    > > FE_FETCH_R                                               $6, !1, ->15
    8     6    >   INIT_FCALL                                               'explode'
          7        SEND_VAL                                                 '_'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                         $7      
         10        ASSIGN                                                   !2, $7
    9    11        FETCH_DIM_R                                      ~9      !2, 0
         12        ASSIGN_DIM                                               !3, ~9
         13        OP_DATA                                                  !1
    7    14      > JMP                                                      ->5
         15    >   FE_FREE                                                  $6
   11    16        INIT_FCALL                                               'array_values'
         17        SEND_VAR                                                 !3
         18        DO_ICALL                                         $11     
         19        ASSIGN                                                   !3, $11
   13    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.16 ms | 1387 KiB | 21 Q