3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array("bla","ble","blu","ab","bc","asdda","fju","ha","y","yi","yid"); $sorted_array = $array; natsort($sorted_array); $grouped_array = array(); foreach ($sorted_array as $item) { $letter = substr($item, 0, 1); $grouped_array[$letter][] = $item; } var_dump($grouped_array);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 18
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/HT91e
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $sorted_array, !2 = $grouped_array, !3 = $item, !4 = $letter
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, !0
    6     2        INIT_FCALL                                               'natsort'
          3        SEND_REF                                                 !1
          4        DO_ICALL                                                 
    8     5        ASSIGN                                                   !2, <array>
    9     6      > FE_RESET_R                                       $9      !1, ->18
          7    > > FE_FETCH_R                                               $9, !3, ->18
   10     8    >   INIT_FCALL                                               'substr'
          9        SEND_VAR                                                 !3
         10        SEND_VAL                                                 0
         11        SEND_VAL                                                 1
         12        DO_ICALL                                         $10     
         13        ASSIGN                                                   !4, $10
   11    14        FETCH_DIM_W                                      $12     !2, !4
         15        ASSIGN_DIM                                               $12
         16        OP_DATA                                                  !3
    9    17      > JMP                                                      ->7
         18    >   FE_FREE                                                  $9
   14    19        INIT_FCALL                                               'var_dump'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.2 ms | 1395 KiB | 19 Q