3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $phpdate = strtotime('0 day'); echo PHP_EOL; function relative_date($time) { $today = strtotime(date('M j, Y')); $reldays = ($time - $today)/86400; if ($reldays >= 0 && $reldays < 1) { return 'Today'; } else if ($reldays >= 1 && $reldays < 2) { return 'Tomorrow'; } else if ($reldays >= -1 && $reldays < 0) { return 'Yesterday'; } } $my_timestamp = "2007-12-15 11:22:47"; //store the results of the function into $my_relative_time $my_relative_time = relative_date(strtotime($my_timestamp )); //output echo $my_relative_time; ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Andsg
function name:  (null)
number of ops:  16
compiled vars:  !0 = $phpdate, !1 = $my_timestamp, !2 = $my_relative_time
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '0+day'
          2        DO_ICALL                                         $3      
          3        ASSIGN                                           ~4      !0, $3
          4        ECHO                                                     ~4
    5     5        ECHO                                                     '%0A'
   29     6        ASSIGN                                                   !1, '2007-12-15+11%3A22%3A47'
   34     7        INIT_FCALL                                               'relative_date'
          8        INIT_FCALL                                               'strtotime'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11        SEND_VAR                                                 $6
         12        DO_FCALL                                      0  $7      
         13        ASSIGN                                                   !2, $7
   39    14        ECHO                                                     !2
   43    15      > RETURN                                                   1

Function relative_date:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
2 jumps found. (Code = 43) Position 1 = 16, Position 2 = 18
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 46) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 23, Position 2 = 25
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
2 jumps found. (Code = 46) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 30, Position 2 = 31
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
Branch analysis from position: 22
Branch analysis from position: 15
filename:       /in/Andsg
function name:  relative_date
number of ops:  32
compiled vars:  !0 = $time, !1 = $today, !2 = $reldays
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'strtotime'
          2        INIT_FCALL                                               'date'
          3        SEND_VAL                                                 'M+j%2C+Y'
          4        DO_ICALL                                         $3      
          5        SEND_VAR                                                 $3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !1, $4
   11     8        SUB                                              ~6      !0, !1
          9        DIV                                              ~7      ~6, 86400
         10        ASSIGN                                                   !2, ~7
   13    11        IS_SMALLER_OR_EQUAL                              ~9      0, !2
         12      > JMPZ_EX                                          ~9      ~9, ->15
         13    >   IS_SMALLER                                       ~10     !2, 1
         14        BOOL                                             ~9      ~10
         15    > > JMPZ                                                     ~9, ->18
   15    16    > > RETURN                                                   'Today'
         17*       JMP                                                      ->31
   17    18    >   IS_SMALLER_OR_EQUAL                              ~11     1, !2
         19      > JMPZ_EX                                          ~11     ~11, ->22
         20    >   IS_SMALLER                                       ~12     !2, 2
         21        BOOL                                             ~11     ~12
         22    > > JMPZ                                                     ~11, ->25
   19    23    > > RETURN                                                   'Tomorrow'
         24*       JMP                                                      ->31
   21    25    >   IS_SMALLER_OR_EQUAL                              ~13     -1, !2
         26      > JMPZ_EX                                          ~13     ~13, ->29
         27    >   IS_SMALLER                                       ~14     !2, 0
         28        BOOL                                             ~13     ~14
         29    > > JMPZ                                                     ~13, ->31
   23    30    > > RETURN                                                   'Yesterday'
   26    31    > > RETURN                                                   null

End of function relative_date

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.4 ms | 1402 KiB | 18 Q