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) { $i = array_search($s['nom'], $final); print_r($i == NULL); if( $i == NULL ) { array_push($final, array($s['nom'])); } } /* if(!isset($final[$i]['data'])) { $final[$i]['data'] = array(); } array_push($final[$i]['data'], $s['temp']); if(!isset($final[$i]['name'])) $final[$i]['name'] = $s['id']; } else { $i = array_search($s['nom'], $final); if(!isset($final[$i]['data'])) { $final[$i]['data'] = array(); } array_push($final[$i]['data'], $s['temp']); } } */ //print_r($final);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 23
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 22
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/dnno8
function name:  (null)
number of ops:  25
compiled vars:  !0 = $sql, !1 = $final, !2 = $s, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $6      !0, ->23
          3    > > FE_FETCH_R                                               $6, !2, ->23
   14     4    >   INIT_FCALL                                               'array_search'
          5        FETCH_DIM_R                                      ~7      !2, 'nom'
          6        SEND_VAL                                                 ~7
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $8      
          9        ASSIGN                                                   !3, $8
   16    10        INIT_FCALL                                               'print_r'
         11        IS_EQUAL                                         ~10     !3, null
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                                 
   17    14        IS_EQUAL                                                 !3, null
         15      > JMPZ                                                     ~12, ->22
   18    16    >   INIT_FCALL                                               'array_push'
         17        SEND_REF                                                 !1
         18        FETCH_DIM_R                                      ~13     !2, 'nom'
         19        INIT_ARRAY                                       ~14     ~13
         20        SEND_VAL                                                 ~14
         21        DO_ICALL                                                 
   13    22    > > JMP                                                      ->3
         23    >   FE_FREE                                                  $6
   42    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
163.22 ms | 1395 KiB | 19 Q