3v4l.org

run code in 300+ 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 = 29
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 29
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 26
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 28
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 26
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
filename:       /in/Aj9ln
function name:  (null)
number of ops:  34
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, ->29
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->29
          3    >   ASSIGN                                                   !2, ~6
   15     4        INIT_FCALL                                               'is_numeric'
          5        INIT_FCALL                                               'substr'
          6        SEND_VAR                                                 !2
          7        SEND_VAL                                                 -1
          8        DO_ICALL                                         $8      
          9        SEND_VAR                                                 $8
         10        DO_ICALL                                         $9      
         11        BOOL_NOT                                         ~10     $9
         12      > JMPZ                                                     ~10, ->26
   16    13    >   INIT_FCALL                                               'substr'
         14        SEND_VAR                                                 !2
         15        SEND_VAL                                                 -1
         16        DO_ICALL                                         $11     
         17        INIT_FCALL                                               'substr'
         18        SEND_VAR                                                 !2
         19        SEND_VAL                                                 0
         20        SEND_VAL                                                 1
         21        DO_ICALL                                         $13     
         22        FETCH_DIM_W                                      $12     !3, $11
         23        ASSIGN_DIM                                               $12, $13
         24        OP_DATA                                                  !1
   15    25      > JMP                                                      ->28
   18    26    >   ASSIGN_DIM                                               !3
         27        OP_DATA                                                  !1
   14    28    > > JMP                                                      ->2
         29    >   FE_FREE                                                  $5
   22    30        INIT_FCALL                                               'var_dump'
         31        SEND_VAR                                                 !3
         32        DO_ICALL                                                 
         33      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.36 ms | 1008 KiB | 16 Q