3v4l.org

run code in 300+ PHP versions simultaneously
<?php $MessagesArray = [ ["date" => "2016/11/27"], ["date" => "2016/11/27"], ["date" => "2016/11/27"], ["date" => "2016/11/27"], ["date" => "2016/11/28"], ["date" => "2016/11/30"], ["date" => "2016/12/01"], ["date" => "2016/12/05"], ["date" => "2017/01/04"], ["date" => "2018/01/15"] ]; $yr = null; $mo = null; $dy = null; foreach ($MessagesArray as $row) { if ($row["date"] == "$yr/$mo/$dy") { continue; } [$y, $m, $d] = explode("/", $row["date"]); if (($m != $mo || $y != $yr) && $mo !== null) { echo "\t</div>\n"; } if ($y != $yr) { if ($yr !== null) { echo "</div>\n"; } echo "<div class='year'>$y\n"; } if ($m != $mo || $y != $yr) { echo "\t<div class='month'>Month $m\n"; } echo "\t\t<div class='day'>Day $d</div>\n"; $yr = $y; $mo = $m; $dy = $d; } if (sizeof($MessagesArray)) { echo "\t</div>\n</div>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 62
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 62
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 15
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 15
2 jumps found. (Code = 47) Position 1 = 29, Position 2 = 31
Branch analysis from position: 29
2 jumps found. (Code = 46) Position 1 = 32, Position 2 = 34
Branch analysis from position: 32
2 jumps found. (Code = 43) Position 1 = 35, Position 2 = 36
Branch analysis from position: 35
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 45
Branch analysis from position: 38
2 jumps found. (Code = 43) Position 1 = 40, Position 2 = 41
Branch analysis from position: 40
2 jumps found. (Code = 47) Position 1 = 47, Position 2 = 49
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 50, Position 2 = 54
Branch analysis from position: 50
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 54
Branch analysis from position: 49
Branch analysis from position: 41
Branch analysis from position: 45
Branch analysis from position: 36
Branch analysis from position: 34
Branch analysis from position: 31
Branch analysis from position: 62
2 jumps found. (Code = 43) Position 1 = 65, Position 2 = 66
Branch analysis from position: 65
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 66
Branch analysis from position: 62
filename:       /in/HbSXI
function name:  (null)
number of ops:  67
compiled vars:  !0 = $MessagesArray, !1 = $yr, !2 = $mo, !3 = $dy, !4 = $row, !5 = $y, !6 = $m, !7 = $d
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, null
   15     2        ASSIGN                                                   !2, null
   16     3        ASSIGN                                                   !3, null
   18     4      > FE_RESET_R                                       $12     !0, ->62
          5    > > FE_FETCH_R                                               $12, !4, ->62
   19     6    >   FETCH_DIM_R                                      ~13     !4, 'date'
          7        ROPE_INIT                                     5  ~15     !1
          8        ROPE_ADD                                      1  ~15     ~15, '%2F'
          9        ROPE_ADD                                      2  ~15     ~15, !2
         10        ROPE_ADD                                      3  ~15     ~15, '%2F'
         11        ROPE_END                                      4  ~14     ~15, !3
         12        IS_EQUAL                                                 ~13, ~14
         13      > JMPZ                                                     ~18, ->15
   20    14    > > JMP                                                      ->5
   22    15    >   INIT_FCALL                                               'explode'
         16        SEND_VAL                                                 '%2F'
         17        FETCH_DIM_R                                      ~19     !4, 'date'
         18        SEND_VAL                                                 ~19
         19        DO_ICALL                                         $20     
         20        FETCH_LIST_R                                     $21     $20, 0
         21        ASSIGN                                                   !5, $21
         22        FETCH_LIST_R                                     $23     $20, 1
         23        ASSIGN                                                   !6, $23
         24        FETCH_LIST_R                                     $25     $20, 2
         25        ASSIGN                                                   !7, $25
         26        FREE                                                     $20
   23    27        IS_NOT_EQUAL                                     ~27     !6, !2
         28      > JMPNZ_EX                                         ~27     ~27, ->31
         29    >   IS_NOT_EQUAL                                     ~28     !5, !1
         30        BOOL                                             ~27     ~28
         31    > > JMPZ_EX                                          ~27     ~27, ->34
         32    >   TYPE_CHECK                                  1020  ~29     !2
         33        BOOL                                             ~27     ~29
         34    > > JMPZ                                                     ~27, ->36
   24    35    >   ECHO                                                     '%09%3C%2Fdiv%3E%0A'
   26    36    >   IS_NOT_EQUAL                                             !5, !1
         37      > JMPZ                                                     ~30, ->45
   27    38    >   TYPE_CHECK                                  1020          !1
         39      > JMPZ                                                     ~31, ->41
   28    40    >   ECHO                                                     '%3C%2Fdiv%3E%0A'
   30    41    >   ROPE_INIT                                     3  ~33     '%3Cdiv+class%3D%27year%27%3E'
         42        ROPE_ADD                                      1  ~33     ~33, !5
         43        ROPE_END                                      2  ~32     ~33, '%0A'
         44        ECHO                                                     ~32
   32    45    >   IS_NOT_EQUAL                                     ~35     !6, !2
         46      > JMPNZ_EX                                         ~35     ~35, ->49
         47    >   IS_NOT_EQUAL                                     ~36     !5, !1
         48        BOOL                                             ~35     ~36
         49    > > JMPZ                                                     ~35, ->54
   33    50    >   ROPE_INIT                                     3  ~38     '%09%3Cdiv+class%3D%27month%27%3EMonth+'
         51        ROPE_ADD                                      1  ~38     ~38, !6
         52        ROPE_END                                      2  ~37     ~38, '%0A'
         53        ECHO                                                     ~37
   35    54    >   ROPE_INIT                                     3  ~41     '%09%09%3Cdiv+class%3D%27day%27%3EDay+'
         55        ROPE_ADD                                      1  ~41     ~41, !7
         56        ROPE_END                                      2  ~40     ~41, '%3C%2Fdiv%3E%0A'
         57        ECHO                                                     ~40
   36    58        ASSIGN                                                   !1, !5
   37    59        ASSIGN                                                   !2, !6
   38    60        ASSIGN                                                   !3, !7
   18    61      > JMP                                                      ->5
         62    >   FE_FREE                                                  $12
   40    63        COUNT                                            ~46     !0
         64      > JMPZ                                                     ~46, ->66
   41    65    >   ECHO                                                     '%09%3C%2Fdiv%3E%0A%3C%2Fdiv%3E'
   42    66    > > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.17 ms | 948 KiB | 16 Q