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 + 0.5 days' => 60 * 60 * 24 + 12 * 60 * 60, '1 month' => '?' ); foreach ($intervals as $interval => $expected) { if (is_numeric($interval)) { $found = (int) $interval; } else { $zeroDate = new \DateTime(); // can't use @0, it will add 3600 seconds to final output on php 5.3.9 - 5.4.7 $zeroDate->setTimestamp(0); $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 = 33
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 33
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 = 26
Branch analysis from position: 26
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: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
filename:       /in/EJJNu
function name:  (null)
number of ops:  35
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>
   15     1      > FE_RESET_R                                       $6      !0, ->33
          2    > > FE_FETCH_R                                       ~7      $6, !1, ->33
          3    >   ASSIGN                                                   !2, ~7
   16     4        INIT_FCALL                                               'is_numeric'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $9      
          7      > JMPZ                                                     $9, ->11
   17     8    >   CAST                                          4  ~10     !2
          9        ASSIGN                                                   !3, ~10
         10      > JMP                                                      ->26
   19    11    >   NEW                                              $12     'DateTime'
         12        DO_FCALL                                      0          
         13        ASSIGN                                                   !4, $12
   21    14        INIT_METHOD_CALL                                         !4, 'setTimestamp'
         15        SEND_VAL_EX                                              0
         16        DO_FCALL                                      0          
   22    17        INIT_METHOD_CALL                                         !4, 'add'
         18        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         19        SEND_VAR                                                 !2
         20        DO_FCALL                                      0  $16     
         21        SEND_VAR_NO_REF_EX                                       $16
         22        DO_FCALL                                      0          
   23    23        INIT_METHOD_CALL                                         !4, 'getTimestamp'
         24        DO_FCALL                                      0  $18     
         25        ASSIGN                                                   !3, $18
   26    26    >   INIT_FCALL                                               'sprintf'
         27        SEND_VAL                                                 'found+%25s+expected+%25s%0A'
         28        SEND_VAR                                                 !3
         29        SEND_VAR                                                 !1
         30        DO_ICALL                                         $20     
         31        ECHO                                                     $20
   15    32      > JMP                                                      ->2
         33    >   FE_FREE                                                  $6
   27    34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.43 ms | 1396 KiB | 17 Q