3v4l.org

run code in 300+ PHP versions simultaneously
<?php $daysInMonth = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $errors = array(); for ($year = 1500; $year < 2000; $year++) { for ($month = 1; $month <= 12; $month++) { $monthErrors = 0; for ($day = 1; $day < $daysInMonth[$month]; $day++) { $baseString = sprintf("%4d-%02d-%02d 00:00:00", $year, $month, $day); $timestamp = strtotime($baseString); $roundTrip = date("Y-m-d H:i:s", $timestamp); if ($baseString !== $roundTrip) { $errors[] = "$baseString ($timestamp) $roundTrip"; $monthErrors++; if ($monthErrors > 10) { break 2; } } } } } $resolvedErrors = array(); if (count($errors) > 50) { $errorCount = count($errors); $delta = $errorCount / 50.0; $currentIndex = 0; do { $resolvedErrors[$currentIndex] = $errors[floor($currentIndex)]; $currentIndex += $delta; } while ($currentIndex < $errorCount); } else { $resolvedErrors = $errors; } echo implode("\n", $resolvedErrors);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 4
Branch analysis from position: 48
2 jumps found. (Code = 43) Position 1 = 52, Position 2 = 67
Branch analysis from position: 52
2 jumps found. (Code = 44) Position 1 = 66, Position 2 = 57
Branch analysis from position: 66
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 57
Branch analysis from position: 67
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 43
Branch analysis from position: 43
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 6
Branch analysis from position: 45
2 jumps found. (Code = 44) Position 1 = 48, Position 2 = 4
Branch analysis from position: 48
Branch analysis from position: 4
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 39
Branch analysis from position: 39
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 9
Branch analysis from position: 42
2 jumps found. (Code = 44) Position 1 = 45, Position 2 = 6
Branch analysis from position: 45
Branch analysis from position: 6
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 38
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 38
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 45
Branch analysis from position: 45
Branch analysis from position: 38
2 jumps found. (Code = 44) Position 1 = 42, Position 2 = 9
Branch analysis from position: 42
Branch analysis from position: 9
Branch analysis from position: 38
filename:       /in/5BEMA
function name:  (null)
number of ops:  74
compiled vars:  !0 = $daysInMonth, !1 = $errors, !2 = $year, !3 = $month, !4 = $monthErrors, !5 = $day, !6 = $baseString, !7 = $timestamp, !8 = $roundTrip, !9 = $resolvedErrors, !10 = $errorCount, !11 = $delta, !12 = $currentIndex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    4     2        ASSIGN                                                   !2, 1500
          3      > JMP                                                      ->46
    5     4    >   ASSIGN                                                   !3, 1
          5      > JMP                                                      ->43
    6     6    >   ASSIGN                                                   !4, 0
    7     7        ASSIGN                                                   !5, 1
          8      > JMP                                                      ->39
    8     9    >   INIT_FCALL                                               'sprintf'
         10        SEND_VAL                                                 '%254d-%2502d-%2502d+00%3A00%3A00'
         11        SEND_VAR                                                 !2
         12        SEND_VAR                                                 !3
         13        SEND_VAR                                                 !5
         14        DO_ICALL                                         $19     
         15        ASSIGN                                                   !6, $19
    9    16        INIT_FCALL                                               'strtotime'
         17        SEND_VAR                                                 !6
         18        DO_ICALL                                         $21     
         19        ASSIGN                                                   !7, $21
   10    20        INIT_FCALL                                               'date'
         21        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
         22        SEND_VAR                                                 !7
         23        DO_ICALL                                         $23     
         24        ASSIGN                                                   !8, $23
   11    25        IS_NOT_IDENTICAL                                         !6, !8
         26      > JMPZ                                                     ~25, ->38
   12    27    >   ROPE_INIT                                     5  ~28     !6
         28        ROPE_ADD                                      1  ~28     ~28, '+%28'
         29        ROPE_ADD                                      2  ~28     ~28, !7
         30        ROPE_ADD                                      3  ~28     ~28, '%29+'
         31        ROPE_END                                      4  ~27     ~28, !8
         32        ASSIGN_DIM                                               !1
         33        OP_DATA                                                  ~27
   13    34        PRE_INC                                                  !4
   14    35        IS_SMALLER                                               10, !4
         36      > JMPZ                                                     ~32, ->38
   15    37    > > JMP                                                      ->45
    7    38    >   PRE_INC                                                  !5
         39    >   FETCH_DIM_R                                      ~34     !0, !3
         40        IS_SMALLER                                               !5, ~34
         41      > JMPNZ                                                    ~35, ->9
    5    42    >   PRE_INC                                                  !3
         43    >   IS_SMALLER_OR_EQUAL                                      !3, 12
         44      > JMPNZ                                                    ~37, ->6
    4    45    >   PRE_INC                                                  !2
         46    >   IS_SMALLER                                               !2, 2000
         47      > JMPNZ                                                    ~39, ->4
   21    48    >   ASSIGN                                                   !9, <array>
   22    49        COUNT                                            ~41     !1
         50        IS_SMALLER                                               50, ~41
         51      > JMPZ                                                     ~42, ->67
   23    52    >   COUNT                                            ~43     !1
         53        ASSIGN                                                   !10, ~43
   24    54        DIV                                              ~45     !10, 50
         55        ASSIGN                                                   !11, ~45
   25    56        ASSIGN                                                   !12, 0
   27    57    >   INIT_FCALL                                               'floor'
         58        SEND_VAR                                                 !12
         59        DO_ICALL                                         $49     
         60        FETCH_DIM_R                                      ~50     !1, $49
         61        ASSIGN_DIM                                               !9, !12
         62        OP_DATA                                                  ~50
   28    63        ASSIGN_OP                                     1          !12, !11
   29    64        IS_SMALLER                                               !12, !10
         65      > JMPNZ                                                    ~52, ->57
         66    > > JMP                                                      ->68
   31    67    >   ASSIGN                                                   !9, !1
   34    68    >   INIT_FCALL                                               'implode'
         69        SEND_VAL                                                 '%0A'
         70        SEND_VAR                                                 !9
         71        DO_ICALL                                         $54     
         72        ECHO                                                     $54
         73      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
165.95 ms | 1404 KiB | 23 Q