3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('Asia/Calcutta'); $end_date = "2014-09-09 12:03:10"; $now = date('Y-m-d H:i:s'); $diff = strtotime($now) - strtotime($end_date); $Days = $diff/(60*60*24); $fullDays = ($now > $end_date) ? floor($Days) : ceil($Days); $Hours = ($diff-($fullDays*60*60*24))/(60*60); $fullHours = ($now > $end_date) ? floor($Hours) : ceil($Hours); $Minutes = ($diff-($fullDays*60*60*24)-($fullHours*60*60))/60; $fullMinutes = ($now > $end_date) ? floor($Minutes) : ceil($Minutes); echo "Difference is $fullDays days, $fullHours hours and $fullMinutes minutes.";
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 25
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
1 jumps found. (Code = 42) Position 1 = 47
Branch analysis from position: 47
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
1 jumps found. (Code = 42) Position 1 = 68
Branch analysis from position: 68
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 64
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 43
2 jumps found. (Code = 43) Position 1 = 59, Position 2 = 64
Branch analysis from position: 59
Branch analysis from position: 64
Branch analysis from position: 25
2 jumps found. (Code = 43) Position 1 = 38, Position 2 = 43
Branch analysis from position: 38
Branch analysis from position: 43
filename:       /in/MUWkZ
function name:  (null)
number of ops:  78
compiled vars:  !0 = $end_date, !1 = $now, !2 = $diff, !3 = $Days, !4 = $fullDays, !5 = $Hours, !6 = $fullHours, !7 = $Minutes, !8 = $fullMinutes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                               'date_default_timezone_set'
          1        SEND_VAL                                                 'Asia%2FCalcutta'
          2        DO_ICALL                                                 
    4     3        ASSIGN                                                   !0, '2014-09-09+12%3A03%3A10'
    5     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        DO_ICALL                                         $11     
          7        ASSIGN                                                   !1, $11
    7     8        INIT_FCALL                                               'strtotime'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $13     
         11        INIT_FCALL                                               'strtotime'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $14     
         14        SUB                                              ~15     $13, $14
         15        ASSIGN                                                   !2, ~15
    8    16        DIV                                              ~17     !2, 86400
         17        ASSIGN                                                   !3, ~17
    9    18        IS_SMALLER                                               !0, !1
         19      > JMPZ                                                     ~19, ->25
         20    >   INIT_FCALL                                               'floor'
         21        SEND_VAR                                                 !3
         22        DO_ICALL                                         $20     
         23        QM_ASSIGN                                        ~21     $20
         24      > JMP                                                      ->29
         25    >   INIT_FCALL                                               'ceil'
         26        SEND_VAR                                                 !3
         27        DO_ICALL                                         $22     
         28        QM_ASSIGN                                        ~21     $22
         29    >   ASSIGN                                                   !4, ~21
   10    30        MUL                                              ~24     !4, 60
         31        MUL                                              ~25     ~24, 60
         32        MUL                                              ~26     ~25, 24
         33        SUB                                              ~27     !2, ~26
         34        DIV                                              ~28     ~27, 3600
         35        ASSIGN                                                   !5, ~28
   11    36        IS_SMALLER                                               !0, !1
         37      > JMPZ                                                     ~30, ->43
         38    >   INIT_FCALL                                               'floor'
         39        SEND_VAR                                                 !5
         40        DO_ICALL                                         $31     
         41        QM_ASSIGN                                        ~32     $31
         42      > JMP                                                      ->47
         43    >   INIT_FCALL                                               'ceil'
         44        SEND_VAR                                                 !5
         45        DO_ICALL                                         $33     
         46        QM_ASSIGN                                        ~32     $33
         47    >   ASSIGN                                                   !6, ~32
   12    48        MUL                                              ~35     !4, 60
         49        MUL                                              ~36     ~35, 60
         50        MUL                                              ~37     ~36, 24
         51        SUB                                              ~38     !2, ~37
         52        MUL                                              ~39     !6, 60
         53        MUL                                              ~40     ~39, 60
         54        SUB                                              ~41     ~38, ~40
         55        DIV                                              ~42     ~41, 60
         56        ASSIGN                                                   !7, ~42
   13    57        IS_SMALLER                                               !0, !1
         58      > JMPZ                                                     ~44, ->64
         59    >   INIT_FCALL                                               'floor'
         60        SEND_VAR                                                 !7
         61        DO_ICALL                                         $45     
         62        QM_ASSIGN                                        ~46     $45
         63      > JMP                                                      ->68
         64    >   INIT_FCALL                                               'ceil'
         65        SEND_VAR                                                 !7
         66        DO_ICALL                                         $47     
         67        QM_ASSIGN                                        ~46     $47
         68    >   ASSIGN                                                   !8, ~46
   14    69        ROPE_INIT                                     7  ~50     'Difference+is+'
         70        ROPE_ADD                                      1  ~50     ~50, !4
         71        ROPE_ADD                                      2  ~50     ~50, '+days%2C+'
         72        ROPE_ADD                                      3  ~50     ~50, !6
         73        ROPE_ADD                                      4  ~50     ~50, '+hours+and+'
         74        ROPE_ADD                                      5  ~50     ~50, !8
         75        ROPE_END                                      6  ~49     ~50, '+minutes.'
         76        ECHO                                                     ~49
         77      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.61 ms | 1400 KiB | 23 Q