3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '1.1', '1.2', '1.3', '2.1', '2.2', '2.3', '3.1', '3.2', ]; $result = []; foreach ($array as $v) { sscanf($v, '%d', $major); if (!isset($ref[$major])) { $result[] = &$ref[$major]; } $ref[$major][] = $v; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/E9MFr
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $result, !2 = $v, !3 = $major, !4 = $ref
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, <array>
   15     2      > FE_RESET_R                                       $7      !0, ->20
          3    > > FE_FETCH_R                                               $7, !2, ->20
   16     4    >   INIT_FCALL                                               'sscanf'
          5        SEND_VAR                                                 !2
          6        SEND_VAL                                                 '%25d'
          7        SEND_REF                                                 !3
          8        DO_ICALL                                                 
   17     9        ISSET_ISEMPTY_DIM_OBJ                         0  ~9      !4, !3
         10        BOOL_NOT                                         ~10     ~9
         11      > JMPZ                                                     ~10, ->16
   18    12    >   FETCH_DIM_W                                      $12     !4, !3
         13        MAKE_REF                                         $13     $12
         14        FETCH_DIM_W                                      $11     !1
         15        ASSIGN_REF                                               $11, $13
   20    16    >   FETCH_DIM_W                                      $15     !4, !3
         17        ASSIGN_DIM                                               $15
         18        OP_DATA                                                  !2
   15    19      > JMP                                                      ->3
         20    >   FE_FREE                                                  $7
   22    21        INIT_FCALL                                               'var_export'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.15 ms | 1406 KiB | 17 Q