3v4l.org

run code in 300+ PHP versions simultaneously
<?php if (!class_exists('DateTime')) { die('DateTime not available yet'); } echo 'Time zone database: ' . timezone_version_get() . PHP_EOL; echo PHP_EOL; date_default_timezone_set('Europe/Madrid'); $start = new DateTime('2017-03-26 01:59:00'); $increments = array( '+2 minutes' => '2017-03-26 03:01:00', '+2 hours' => '2017-03-26 04:59:00', ); echo 'Start: ' . $start->format('r') . PHP_EOL; foreach ($increments as $increment => $expected_string) { echo '>>> ' . $increment . PHP_EOL; $expected_end = new DateTime($expected_string); $actual_end = clone $start; $actual_end->modify($increment); echo 'Expected end: ' . $expected_end->format('r') . PHP_EOL; echo 'Actual end: ' . $actual_end->format('r') . PHP_EOL; echo ($expected_end->format('c')===$actual_end->format('c') ? 'OK' : 'ERROR') . PHP_EOL; echo PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 6
Branch analysis from position: 5
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 68
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 68
Branch analysis from position: 28
2 jumps found. (Code = 43) Position 1 = 61, Position 2 = 63
Branch analysis from position: 61
1 jumps found. (Code = 42) Position 1 = 64
Branch analysis from position: 64
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 63
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 68
filename:       /in/1Q4OK
function name:  (null)
number of ops:  70
compiled vars:  !0 = $start, !1 = $increments, !2 = $expected_string, !3 = $increment, !4 = $expected_end, !5 = $actual_end
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'class_exists'
          1        SEND_VAL                                                 'DateTime'
          2        DO_ICALL                                         $6      
          3        BOOL_NOT                                         ~7      $6
          4      > JMPZ                                                     ~7, ->6
    4     5    > > EXIT                                                     'DateTime+not+available+yet'
    7     6    >   INIT_FCALL                                               'timezone_version_get'
          7        DO_ICALL                                         $8      
          8        CONCAT                                           ~9      'Time+zone+database%3A+', $8
          9        CONCAT                                           ~10     ~9, '%0A'
         10        ECHO                                                     ~10
    8    11        ECHO                                                     '%0A'
   10    12        INIT_FCALL                                               'date_default_timezone_set'
         13        SEND_VAL                                                 'Europe%2FMadrid'
         14        DO_ICALL                                                 
   12    15        NEW                                              $12     'DateTime'
         16        SEND_VAL_EX                                              '2017-03-26+01%3A59%3A00'
         17        DO_FCALL                                      0          
         18        ASSIGN                                                   !0, $12
   13    19        ASSIGN                                                   !1, <array>
   18    20        INIT_METHOD_CALL                                         !0, 'format'
         21        SEND_VAL_EX                                              'r'
         22        DO_FCALL                                      0  $16     
         23        CONCAT                                           ~17     'Start%3A++++++++', $16
         24        CONCAT                                           ~18     ~17, '%0A'
         25        ECHO                                                     ~18
   19    26      > FE_RESET_R                                       $19     !1, ->68
         27    > > FE_FETCH_R                                       ~20     $19, !2, ->68
         28    >   ASSIGN                                                   !3, ~20
   20    29        CONCAT                                           ~22     '%3E%3E%3E+', !3
         30        CONCAT                                           ~23     ~22, '%0A'
         31        ECHO                                                     ~23
   22    32        NEW                                              $24     'DateTime'
         33        SEND_VAR_EX                                              !2
         34        DO_FCALL                                      0          
         35        ASSIGN                                                   !4, $24
   23    36        CLONE                                            ~27     !0
         37        ASSIGN                                                   !5, ~27
   24    38        INIT_METHOD_CALL                                         !5, 'modify'
         39        SEND_VAR_EX                                              !3
         40        DO_FCALL                                      0          
   26    41        INIT_METHOD_CALL                                         !4, 'format'
         42        SEND_VAL_EX                                              'r'
         43        DO_FCALL                                      0  $30     
         44        CONCAT                                           ~31     'Expected+end%3A+', $30
         45        CONCAT                                           ~32     ~31, '%0A'
         46        ECHO                                                     ~32
   27    47        INIT_METHOD_CALL                                         !5, 'format'
         48        SEND_VAL_EX                                              'r'
         49        DO_FCALL                                      0  $33     
         50        CONCAT                                           ~34     'Actual+end%3A+++', $33
         51        CONCAT                                           ~35     ~34, '%0A'
         52        ECHO                                                     ~35
   28    53        INIT_METHOD_CALL                                         !4, 'format'
         54        SEND_VAL_EX                                              'c'
         55        DO_FCALL                                      0  $36     
         56        INIT_METHOD_CALL                                         !5, 'format'
         57        SEND_VAL_EX                                              'c'
         58        DO_FCALL                                      0  $37     
         59        IS_IDENTICAL                                             $36, $37
         60      > JMPZ                                                     ~38, ->63
         61    >   QM_ASSIGN                                        ~39     'OK'
         62      > JMP                                                      ->64
         63    >   QM_ASSIGN                                        ~39     'ERROR'
         64    >   CONCAT                                           ~40     ~39, '%0A'
         65        ECHO                                                     ~40
   29    66        ECHO                                                     '%0A'
   19    67      > JMP                                                      ->27
         68    >   FE_FREE                                                  $19
   30    69      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
134.18 ms | 1405 KiB | 19 Q