3v4l.org

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

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.7 ms | 1400 KiB | 19 Q