3v4l.org

run code in 300+ PHP versions simultaneously
<?php $json='[{"from":"2019-07-22 09:00:00","to":"2019-07-22 11:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Close"},{"from":"2019-07-22 07:00:00","to":"2019-07-22 08:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Close"},{"from":"2019-07-22 07:00:00","to":"2019-07-22 08:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Open"},{"from":"2019-07-22 20:00:00","to":"2019-07-22 22:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Open"},{"from":"2019-07-22 11:00:00","to":"2019-07-22 17:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Open"},{"from":"2019-07-22 20:00:00","to":"2019-07-22 22:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Close"},{"from":"2019-07-22 07:00:00","to":"2019-07-22 15:00:00","rendering":"background","resource":"3529","backgroundColor":"#660000","purpose":"Close"}]'; //var_export(json_decode($json, true)); foreach (json_decode($json, true) as $i => $entry) { if (!$i) { $result[] = $entry; } else { foreach ($result as $stored) { if (($entry['from'] >= $stored['from'] && $entry['from'] < $stored['to']) || ($entry['to'] > $stored['from'] && $entry['to'] <= $stored['to'])) { continue 2; } } $result[] = $entry; } } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 41
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 41
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 40
Branch analysis from position: 40
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 13
2 jumps found. (Code = 77) Position 1 = 14, Position 2 = 37
Branch analysis from position: 14
2 jumps found. (Code = 78) Position 1 = 15, Position 2 = 37
Branch analysis from position: 15
2 jumps found. (Code = 46) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
2 jumps found. (Code = 47) Position 1 = 24, Position 2 = 33
Branch analysis from position: 24
2 jumps found. (Code = 46) Position 1 = 28, Position 2 = 32
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 34, Position 2 = 36
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 36
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
Branch analysis from position: 32
Branch analysis from position: 33
Branch analysis from position: 23
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 37
Branch analysis from position: 41
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 41
filename:       /in/GTgmr
function name:  (null)
number of ops:  46
compiled vars:  !0 = $json, !1 = $entry, !2 = $i, !3 = $result, !4 = $stored
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%5B%7B%22from%22%3A%222019-07-22+09%3A00%3A00%22%2C%22to%22%3A%222019-07-22+11%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Close%22%7D%2C%7B%22from%22%3A%222019-07-22+07%3A00%3A00%22%2C%22to%22%3A%222019-07-22+08%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Close%22%7D%2C%7B%22from%22%3A%222019-07-22+07%3A00%3A00%22%2C%22to%22%3A%222019-07-22+08%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Open%22%7D%2C%7B%22from%22%3A%222019-07-22+20%3A00%3A00%22%2C%22to%22%3A%222019-07-22+22%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Open%22%7D%2C%7B%22from%22%3A%222019-07-22+11%3A00%3A00%22%2C%22to%22%3A%222019-07-22+17%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Open%22%7D%2C%7B%22from%22%3A%222019-07-22+20%3A00%3A00%22%2C%22to%22%3A%222019-07-22+22%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Close%22%7D%2C%7B%22from%22%3A%222019-07-22+07%3A00%3A00%22%2C%22to%22%3A%222019-07-22+15%3A00%3A00%22%2C%22rendering%22%3A%22background%22%2C%22resource%22%3A%223529%22%2C%22backgroundColor%22%3A%22%23660000%22%2C%22purpose%22%3A%22Close%22%7D%5D'
    4     1        INIT_FCALL                                               'json_decode'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $6      
          5      > FE_RESET_R                                       $7      $6, ->41
          6    > > FE_FETCH_R                                       ~8      $7, !1, ->41
          7    >   ASSIGN                                                   !2, ~8
    5     8        BOOL_NOT                                         ~10     !2
          9      > JMPZ                                                     ~10, ->13
    6    10    >   ASSIGN_DIM                                               !3
         11        OP_DATA                                                  !1
    5    12      > JMP                                                      ->40
    8    13    > > FE_RESET_R                                       $12     !3, ->37
         14    > > FE_FETCH_R                                               $12, !4, ->37
    9    15    >   FETCH_DIM_R                                      ~13     !1, 'from'
         16        FETCH_DIM_R                                      ~14     !4, 'from'
         17        IS_SMALLER_OR_EQUAL                              ~15     ~14, ~13
         18      > JMPZ_EX                                          ~15     ~15, ->23
         19    >   FETCH_DIM_R                                      ~16     !1, 'from'
         20        FETCH_DIM_R                                      ~17     !4, 'to'
         21        IS_SMALLER                                       ~18     ~16, ~17
         22        BOOL                                             ~15     ~18
         23    > > JMPNZ_EX                                         ~15     ~15, ->33
   10    24    >   FETCH_DIM_R                                      ~19     !1, 'to'
         25        FETCH_DIM_R                                      ~20     !4, 'from'
         26        IS_SMALLER                                       ~21     ~20, ~19
         27      > JMPZ_EX                                          ~21     ~21, ->32
         28    >   FETCH_DIM_R                                      ~22     !1, 'to'
         29        FETCH_DIM_R                                      ~23     !4, 'to'
         30        IS_SMALLER_OR_EQUAL                              ~24     ~22, ~23
         31        BOOL                                             ~21     ~24
         32    >   BOOL                                             ~15     ~21
         33    > > JMPZ                                                     ~15, ->36
   11    34    >   FE_FREE                                                  $12
         35      > JMP                                                      ->6
    8    36    > > JMP                                                      ->14
         37    >   FE_FREE                                                  $12
   14    38        ASSIGN_DIM                                               !3
         39        OP_DATA                                                  !1
    4    40    > > JMP                                                      ->6
         41    >   FE_FREE                                                  $7
   17    42        INIT_FCALL                                               'var_export'
         43        SEND_VAR                                                 !3
         44        DO_ICALL                                                 
         45      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
136.13 ms | 1006 KiB | 15 Q