3v4l.org

run code in 300+ PHP versions simultaneously
<?php $beforDate=DateTime::createFromFormat('Y-m-d G:i:s', '1900-01-01 00:00:00'); $afterDate=DateTime::createFromFormat('Y-m-d G:i:s', '2021-01-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-01-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/QkOl8
function name:  (null)
number of ops:  36
compiled vars:  !0 = $beforDate, !1 = $afterDate, !2 = $dtInterval, !3 = $daysPassed
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          1        SEND_VAL                                                 'Y-m-d+G%3Ai%3As'
          2        SEND_VAL                                                 '1900-01-01+00%3A00%3A00'
          3        DO_FCALL                                      0  $4      
          4        ASSIGN                                                   !0, $4
    3     5        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
          6        SEND_VAL                                                 'Y-m-d+G%3Ai%3As'
          7        SEND_VAL                                                 '2021-01-08+00%3A00%3A42'
          8        DO_FCALL                                      0  $6      
          9        ASSIGN                                                   !1, $6
    4    10        INIT_METHOD_CALL                                         !0, 'diff'
         11        SEND_VAR_EX                                              !1
         12        DO_FCALL                                      0  $8      
         13        ASSIGN                                                   !2, $8
    5    14        FETCH_OBJ_R                                      ~10     !2, 'days'
         15        ASSIGN                                                   !3, ~10
    6    16        NOP                                                      
         17        FAST_CONCAT                                      ~12     'days+passed+if+target+date+have+42+seconds+from+midnight%3A+', !3
         18        CONCAT                                           ~13     ~12, '%0A'
         19        ECHO                                                     ~13
    7    20        INIT_STATIC_METHOD_CALL                                  'DateTime', 'createFromFormat'
         21        SEND_VAL                                                 'Y-m-d+G%3Ai%3As'
         22        SEND_VAL                                                 '2021-01-08+00%3A00%3A43'
         23        DO_FCALL                                      0  $14     
         24        ASSIGN                                                   !1, $14
    8    25        INIT_METHOD_CALL                                         !0, 'diff'
         26        SEND_VAR_EX                                              !1
         27        DO_FCALL                                      0  $16     
         28        ASSIGN                                                   !2, $16
    9    29        FETCH_OBJ_R                                      ~18     !2, 'days'
         30        ASSIGN                                                   !3, ~18
   10    31        NOP                                                      
         32        FAST_CONCAT                                      ~20     'days+passed+if+target+date+have+43+seconds+from+midnight%3A+', !3
         33        CONCAT                                           ~21     ~20, '%0A'
         34        ECHO                                                     ~21
   11    35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.27 ms | 1065 KiB | 13 Q