3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sessions=json_decode('[ {heure_debut:"08:00",heure_fin:"09:00"}, {heure_debut:"09:10",heure_fin:"10:00"}, {heure_debut:"10:00",heure_fin:"11:00"}, {heure_debut:"11:00",heure_fin:"12:00"}, {heure_debut:"12:00",heure_fin:"13:00"}, {heure_debut:"13:00",heure_fin:"14:30"} ]',TRUE); $real_sessions=array("heure_debut"=>$sessions[0]["heure_debut"],"heure_fin"=>$sessions[0]["heure_fin"]); $j=0; for($i=1;i<count($sessions);$i++){ if($real_sessions[$j]["heure_fin"]===$sessions[$i]["heure_debut"]){ $real_sessions[j]["heure_fin"]=$sessions[i]["heure_fin"]; }else{ $real_sessions[]=array("heure_debut"=>$sessions[$i]["heure_debut"],"heure_fin"=>$sessions[$i]["heure_fin"]);; $j++; } } print_r($real_sessions);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 15
Branch analysis from position: 43
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 21, Position 2 = 29
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 38
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 15
Branch analysis from position: 43
Branch analysis from position: 15
Branch analysis from position: 29
2 jumps found. (Code = 44) Position 1 = 43, Position 2 = 15
Branch analysis from position: 43
Branch analysis from position: 15
filename:       /in/Hdl14
function name:  (null)
number of ops:  47
compiled vars:  !0 = $sessions, !1 = $real_sessions, !2 = $j, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'json_decode'
          1        SEND_VAL                                                 '%5B%0A++++++++%7Bheure_debut%3A%2208%3A00%22%2Cheure_fin%3A%2209%3A00%22%7D%2C%0A++++++++%7Bheure_debut%3A%2209%3A10%22%2Cheure_fin%3A%2210%3A00%22%7D%2C%0A++++++++%7Bheure_debut%3A%2210%3A00%22%2Cheure_fin%3A%2211%3A00%22%7D%2C%0A++++++++%7Bheure_debut%3A%2211%3A00%22%2Cheure_fin%3A%2212%3A00%22%7D%2C%0A++++++++%7Bheure_debut%3A%2212%3A00%22%2Cheure_fin%3A%2213%3A00%22%7D%2C%0A++++++++%7Bheure_debut%3A%2213%3A00%22%2Cheure_fin%3A%2214%3A30%22%7D%0A%5D'
    9     2        SEND_VAL                                                 <true>
          3        DO_ICALL                                         $4      
    2     4        ASSIGN                                                   !0, $4
   11     5        FETCH_DIM_R                                      ~6      !0, 0
          6        FETCH_DIM_R                                      ~7      ~6, 'heure_debut'
          7        INIT_ARRAY                                       ~8      ~7, 'heure_debut'
          8        FETCH_DIM_R                                      ~9      !0, 0
          9        FETCH_DIM_R                                      ~10     ~9, 'heure_fin'
         10        ADD_ARRAY_ELEMENT                                ~8      ~10, 'heure_fin'
         11        ASSIGN                                                   !1, ~8
   12    12        ASSIGN                                                   !2, 0
   14    13        ASSIGN                                                   !3, 1
         14      > JMP                                                      ->39
   16    15    >   FETCH_DIM_R                                      ~14     !1, !2
         16        FETCH_DIM_R                                      ~15     ~14, 'heure_fin'
         17        FETCH_DIM_R                                      ~16     !0, !3
         18        FETCH_DIM_R                                      ~17     ~16, 'heure_debut'
         19        IS_IDENTICAL                                             ~15, ~17
         20      > JMPZ                                                     ~18, ->29
   18    21    >   FETCH_CONSTANT                                   ~19     'j'
         22        FETCH_CONSTANT                                   ~22     'i'
         23        FETCH_DIM_R                                      ~23     !0, ~22
         24        FETCH_DIM_R                                      ~24     ~23, 'heure_fin'
         25        FETCH_DIM_W                                      $20     !1, ~19
         26        ASSIGN_DIM                                               $20, 'heure_fin'
         27        OP_DATA                                                  ~24
         28      > JMP                                                      ->38
   20    29    >   FETCH_DIM_R                                      ~26     !0, !3
         30        FETCH_DIM_R                                      ~27     ~26, 'heure_debut'
         31        INIT_ARRAY                                       ~28     ~27, 'heure_debut'
         32        FETCH_DIM_R                                      ~29     !0, !3
         33        FETCH_DIM_R                                      ~30     ~29, 'heure_fin'
         34        ADD_ARRAY_ELEMENT                                ~28     ~30, 'heure_fin'
         35        ASSIGN_DIM                                               !1
         36        OP_DATA                                                  ~28
   21    37        PRE_INC                                                  !2
   14    38    >   PRE_INC                                                  !3
         39    >   FETCH_CONSTANT                                   ~33     'i'
         40        COUNT                                            ~34     !0
         41        IS_SMALLER                                               ~33, ~34
         42      > JMPNZ                                                    ~35, ->15
   25    43    >   INIT_FCALL                                               'print_r'
         44        SEND_VAR                                                 !1
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.75 ms | 1400 KiB | 17 Q