3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = array( "1" => "0", "2" => "5", "5" => "7", "1C" => "0", "2C" => "5", "5C" => "10", "1S" => "15", "5S" => "20" ); Foreach($array as $key => $item){ If(!is_numeric(substr($key, -1))){ $new[substr($key, -1)][substr($key, 0,1)] = $item; }Else{ $new[] = $item; } } Var_dump($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 18
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 15
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/Aj9ln
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $item, !2 = $key, !3 = $new
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   14     1      > FE_RESET_R                                           $5      !0, ->18
          2    > > FE_FETCH_R                                           ~6      $5, !1, ->18
          3    >   ASSIGN                                                       !2, ~6
   15     4        FRAMELESS_ICALL_2                substr              ~8      !2, -1
          5        FRAMELESS_ICALL_1                is_numeric          ~9      ~8
          6        BOOL_NOT                                             ~10     ~9
          7      > JMPZ                                                         ~10, ->15
   16     8    >   FRAMELESS_ICALL_2                substr              ~11     !2, -1
          9        FRAMELESS_ICALL_3                substr              ~13     !2, 0
         10        OP_DATA                                                      1
         11        FETCH_DIM_W                                          $12     !3, ~11
         12        ASSIGN_DIM                                                   $12, ~13
         13        OP_DATA                                                      !1
   15    14      > JMP                                                          ->17
   18    15    >   ASSIGN_DIM                                                   !3
         16        OP_DATA                                                      !1
   14    17    > > JMP                                                          ->2
         18    >   FE_FREE                                                      $5
   22    19        INIT_FCALL                                                   'var_dump'
         20        SEND_VAR                                                     !3
         21        DO_ICALL                                                     
         22      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.16 ms | 2250 KiB | 14 Q