3v4l.org

run code in 300+ PHP versions simultaneously
<?php $intervals = array( '1 second' => 1, '1 minute' => 60 * 60, '1 day' => 60 * 60 * 24, '1 year' => 60 * 60 * 24 * 365 ); foreach ($intervals as $interval => $expected) { $zeroDate = new \DateTime('@0'); var_dump($zeroDate->getTimestamp()); $zeroDate->add(\DateInterval::createFromDateString($interval)); echo sprintf("found %s expected %s\n", $zeroDate->getTimestamp(), $expected); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 28
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 28
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 28
filename:       /in/XiYTc
function name:  (null)
number of ops:  30
compiled vars:  !0 = $intervals, !1 = $expected, !2 = $interval, !3 = $zeroDate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1      > FE_RESET_R                                       $5      !0, ->28
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->28
          3    >   ASSIGN                                                   !2, ~6
   10     4        NEW                                              $8      'DateTime'
          5        SEND_VAL_EX                                              '%400'
          6        DO_FCALL                                      0          
          7        ASSIGN                                                   !3, $8
   11     8        INIT_FCALL                                               'var_dump'
          9        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         10        DO_FCALL                                      0  $11     
         11        SEND_VAR                                                 $11
         12        DO_ICALL                                                 
   12    13        INIT_METHOD_CALL                                         !3, 'add'
         14        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         15        SEND_VAR                                                 !2
         16        DO_FCALL                                      0  $13     
         17        SEND_VAR_NO_REF_EX                                       $13
         18        DO_FCALL                                      0          
   14    19        INIT_FCALL                                               'sprintf'
         20        SEND_VAL                                                 'found+%25s+expected+%25s%0A'
         21        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         22        DO_FCALL                                      0  $15     
         23        SEND_VAR                                                 $15
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                         $16     
         26        ECHO                                                     $16
    9    27      > JMP                                                      ->2
         28    >   FE_FREE                                                  $5
   15    29      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.61 ms | 1396 KiB | 17 Q