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'); $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 = 23
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 23
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/qQYcr
function name:  (null)
number of ops:  25
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, ->23
          2    > > FE_FETCH_R                                       ~6      $5, !1, ->23
          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_METHOD_CALL                                         !3, 'add'
          9        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         10        SEND_VAR                                                 !2
         11        DO_FCALL                                      0  $11     
         12        SEND_VAR_NO_REF_EX                                       $11
         13        DO_FCALL                                      0          
   13    14        INIT_FCALL                                               'sprintf'
         15        SEND_VAL                                                 'found+%25s+expected+%25s%0A'
         16        INIT_METHOD_CALL                                         !3, 'getTimestamp'
         17        DO_FCALL                                      0  $13     
         18        SEND_VAR                                                 $13
         19        SEND_VAR                                                 !1
         20        DO_ICALL                                         $14     
         21        ECHO                                                     $14
    9    22      > JMP                                                      ->2
         23    >   FE_FREE                                                  $5
   14    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
176.64 ms | 1395 KiB | 15 Q