3v4l.org

run code in 500+ PHP versions simultaneously
<?php date_default_timezone_set('Europe/Moscow'); $beforDate=DateTime::createFromFormat('Y-m-d G:i:s', '1900-01-01 00:00:00'); // monday, 1-st Jan of 1900 $afterDate=DateTime::createFromFormat('Y-m-d G:i:s', '2021-02-08 00:00:42'); $dtInterval = $beforDate->diff($afterDate); $daysPassed = $dtInterval->days; echo "days passed if target date have 42 seconds from midnight: $daysPassed" . PHP_EOL; $afterDate=DateTime::createFromFormat('Y-m-d G:i:s', '2021-02-08 00:00:43'); $dtInterval = $beforDate->diff($afterDate); $daysPassed = $dtInterval->days; echo "days passed if target date have 43 seconds from midnight: $daysPassed" . PHP_EOL;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Rm4Sp
function name:  (null)
number of ops:  39
compiled vars:  !0 = $beforDate, !1 = $afterDate, !2 = $dtInterval, !3 = $daysPassed
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                                   'date_default_timezone_set'
          1        SEND_VAL                                                     'Europe%2FMoscow'
          2        DO_ICALL                                                     
    5     3        INIT_STATIC_METHOD_CALL                                      'DateTime', 'createFromFormat'
          4        SEND_VAL                                                     'Y-m-d+G%3Ai%3As'
          5        SEND_VAL                                                     '1900-01-01+00%3A00%3A00'
          6        DO_FCALL                                          0  $5      
          7        ASSIGN                                                       !0, $5
    7     8        INIT_STATIC_METHOD_CALL                                      'DateTime', 'createFromFormat'
          9        SEND_VAL                                                     'Y-m-d+G%3Ai%3As'
         10        SEND_VAL                                                     '2021-02-08+00%3A00%3A42'
         11        DO_FCALL                                          0  $7      
         12        ASSIGN                                                       !1, $7
    8    13        INIT_METHOD_CALL                                             !0, 'diff'
         14        SEND_VAR_EX                                                  !1
         15        DO_FCALL                                          0  $9      
         16        ASSIGN                                                       !2, $9
    9    17        FETCH_OBJ_R                                          ~11     !2, 'days'
         18        ASSIGN                                                       !3, ~11
   10    19        NOP                                                          
         20        FAST_CONCAT                                          ~13     'days+passed+if+target+date+have+42+seconds+from+midnight%3A+', !3
         21        CONCAT                                               ~14     ~13, '%0A'
         22        ECHO                                                         ~14
   12    23        INIT_STATIC_METHOD_CALL                                      'DateTime', 'createFromFormat'
         24        SEND_VAL                                                     'Y-m-d+G%3Ai%3As'
         25        SEND_VAL                                                     '2021-02-08+00%3A00%3A43'
         26        DO_FCALL                                          0  $15     
         27        ASSIGN                                                       !1, $15
   13    28        INIT_METHOD_CALL                                             !0, 'diff'
         29        SEND_VAR_EX                                                  !1
         30        DO_FCALL                                          0  $17     
         31        ASSIGN                                                       !2, $17
   14    32        FETCH_OBJ_R                                          ~19     !2, 'days'
         33        ASSIGN                                                       !3, ~19
   15    34        NOP                                                          
         35        FAST_CONCAT                                          ~21     'days+passed+if+target+date+have+43+seconds+from+midnight%3A+', !3
         36        CONCAT                                               ~22     ~21, '%0A'
         37        ECHO                                                         ~22
   16    38      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
126.37 ms | 482 KiB | 8 Q