3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ "Aulas Gratuitas", "149", "151", "153", "Módulo 0", "964", "989", "967", "978", "Módulo 1", "985", "1079", "1001", "1003", "1005", "Módulo 2", ]; $result = []; foreach ($array as $value) { if (!ctype_digit($value)) { $result[] = ['title' => $value, 'units' => []]; } else { $result[array_key_last($result)]['units'][] = $value; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 14
Branch analysis from position: 9
1 jumps found. (Code = 42) Position 1 = 21
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/icHdk
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $result, !2 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   22     1        ASSIGN                                                   !1, <array>
   23     2      > FE_RESET_R                                       $5      !0, ->22
          3    > > FE_FETCH_R                                               $5, !2, ->22
   24     4    >   INIT_FCALL                                               'ctype_digit'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        BOOL_NOT                                         ~7      $6
          8      > JMPZ                                                     ~7, ->14
   25     9    >   INIT_ARRAY                                       ~9      !2, 'title'
         10        ADD_ARRAY_ELEMENT                                ~9      <array>, 'units'
         11        ASSIGN_DIM                                               !1
         12        OP_DATA                                                  ~9
   24    13      > JMP                                                      ->21
   27    14    >   INIT_FCALL                                               'array_key_last'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $10     
         17        FETCH_DIM_W                                      $11     !1, $10
         18        FETCH_DIM_W                                      $12     $11, 'units'
         19        ASSIGN_DIM                                               $12
         20        OP_DATA                                                  !2
   23    21    > > JMP                                                      ->3
         22    >   FE_FREE                                                  $5
   30    23        INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
231.45 ms | 1008 KiB | 16 Q