3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sql = array(array('id' => 0, 'nom' => 'A', 'temp' => 1.1, 'autre' => 0), array('id' => 1, 'nom' => 'A', 'temp' => 2.1, 'autre' => 10), array('id' => 2, 'nom' => 'A', 'temp' => 3.1, 'autre' => 20), array('id' => 3, 'nom' => 'B', 'temp' => 4.1, 'autre' => 30), array('id' => 4, 'nom' => 'C', 'temp' => 5.1, 'autre' => 40), array('id' => 5, 'nom' => 'B', 'temp' => 6.1, 'autre' => 50), array('id' => 6, 'nom' => 'A', 'temp' => 7.1, 'autre' => 60)); $final = array(); foreach ($sql as $s) if(isset($final[$s['nom']])) array_push($final[$s['nom']], array($s['temp'], $s['autre'])); else $final[$s['nom']] = array($s['temp'], $s['autre']); print_r($final);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 26
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 26
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 18
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
filename:       /in/HjQ3H
function name:  (null)
number of ops:  31
compiled vars:  !0 = $sql, !1 = $final, !2 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $5      !0, ->26
          3    > > FE_FETCH_R                                               $5, !2, ->26
   11     4    >   FETCH_DIM_R                                      ~6      !2, 'nom'
          5        ISSET_ISEMPTY_DIM_OBJ                         0          !1, ~6
          6      > JMPZ                                                     ~7, ->18
   12     7    >   INIT_FCALL                                               'array_push'
          8        FETCH_DIM_R                                      ~8      !2, 'nom'
          9        FETCH_DIM_W                                      $9      !1, ~8
         10        SEND_REF                                                 $9
         11        FETCH_DIM_R                                      ~10     !2, 'temp'
         12        INIT_ARRAY                                       ~11     ~10
         13        FETCH_DIM_R                                      ~12     !2, 'autre'
         14        ADD_ARRAY_ELEMENT                                ~11     ~12
         15        SEND_VAL                                                 ~11
         16        DO_ICALL                                                 
         17      > JMP                                                      ->25
   14    18    >   FETCH_DIM_R                                      ~14     !2, 'nom'
         19        FETCH_DIM_R                                      ~16     !2, 'temp'
         20        INIT_ARRAY                                       ~17     ~16
         21        FETCH_DIM_R                                      ~18     !2, 'autre'
         22        ADD_ARRAY_ELEMENT                                ~17     ~18
         23        ASSIGN_DIM                                               !1, ~14
         24        OP_DATA                                                  ~17
   10    25    > > JMP                                                      ->3
         26    >   FE_FREE                                                  $5
   16    27        INIT_FCALL                                               'print_r'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
         30      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.65 ms | 1396 KiB | 17 Q