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 $zeroDate->modify(sprintf('-%s seconds', $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 = 40
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 40
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 = 33
Branch analysis from position: 33
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: 40
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 40
filename:       /in/m7lY2
function name:  (null)
number of ops:  42
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, ->40
          2    > > FE_FETCH_R                                       ~7      $6, !1, ->40
          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                                                      ->33
   18    11    >   NEW                                              $12     'DateTime'
         12        SEND_VAL_EX                                              '0'
         13        DO_FCALL                                      0          
         14        ASSIGN                                                   !4, $12
   20    15        INIT_METHOD_CALL                                         !4, 'modify'
         16        INIT_FCALL                                               'sprintf'
         17        SEND_VAL                                                 '-%25s+seconds'
         18        INIT_METHOD_CALL                                         !4, 'getTimestamp'
         19        DO_FCALL                                      0  $15     
         20        SEND_VAR                                                 $15
         21        DO_ICALL                                         $16     
         22        SEND_VAR_NO_REF_EX                                       $16
         23        DO_FCALL                                      0          
   21    24        INIT_METHOD_CALL                                         !4, 'add'
         25        INIT_STATIC_METHOD_CALL                                  'DateInterval', 'createFromDateString'
         26        SEND_VAR                                                 !2
         27        DO_FCALL                                      0  $18     
         28        SEND_VAR_NO_REF_EX                                       $18
         29        DO_FCALL                                      0          
   22    30        INIT_METHOD_CALL                                         !4, 'getTimestamp'
         31        DO_FCALL                                      0  $20     
         32        ASSIGN                                                   !3, $20
   25    33    >   INIT_FCALL                                               'sprintf'
         34        SEND_VAL                                                 'found+%25s+expected+%25s%0A'
         35        SEND_VAR                                                 !3
         36        SEND_VAR                                                 !1
         37        DO_ICALL                                         $22     
         38        ECHO                                                     $22
   14    39      > JMP                                                      ->2
         40    >   FE_FREE                                                  $6
   26    41      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.39 ms | 1400 KiB | 17 Q