3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $phpdate = strtotime('+2 day'); echo PHP_EOL; echo $mysqldate = date('Y-m-d H:i:s', $phpdate); echo PHP_EOL; function formatDate($timestamp) { if ($timestamp >= strtotime('today')) { return 'Today'; } elseif ($timestamp >= strtotime('yesterday')) { return 'Yesterday'; } else { return date('M j, Y', $date); } } echo formatDate($phpdate); /*$last_access = $phpdate; $now = time(); $last_midnight = $now - ($now % (24*60*60)); if ($last_access >= $last_midnight) { print "Today"; } elseif ($last_access >= ($last_midnight-(24*60*60))) { print "Yesterday"; } else{print 'AAAA';} */ ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GPQ6e
function name:  (null)
number of ops:  18
compiled vars:  !0 = $phpdate, !1 = $mysqldate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 '%2B2+day'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                           ~3      !0, $2
          4        ECHO                                                     ~3
    5     5        ECHO                                                     '%0A'
    6     6        INIT_FCALL                                               'date'
          7        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                         $4      
         10        ASSIGN                                           ~5      !1, $4
         11        ECHO                                                     ~5
    7    12        ECHO                                                     '%0A'
   19    13        INIT_FCALL                                               'formatdate'
         14        SEND_VAR                                                 !0
         15        DO_FCALL                                      0  $6      
         16        ECHO                                                     $6
   42    17      > RETURN                                                   1

Function formatdate:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 8
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GPQ6e
function name:  formatDate
number of ops:  21
compiled vars:  !0 = $timestamp, !1 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_FCALL                                               'strtotime'
          2        SEND_VAL                                                 'today'
          3        DO_ICALL                                         $2      
          4        IS_SMALLER_OR_EQUAL                                      $2, !0
          5      > JMPZ                                                     ~3, ->8
   11     6    > > RETURN                                                   'Today'
          7*       JMP                                                      ->20
   12     8    >   INIT_FCALL                                               'strtotime'
          9        SEND_VAL                                                 'yesterday'
         10        DO_ICALL                                         $4      
         11        IS_SMALLER_OR_EQUAL                                      $4, !0
         12      > JMPZ                                                     ~5, ->15
   13    13    > > RETURN                                                   'Yesterday'
         14*       JMP                                                      ->20
   15    15    >   INIT_FCALL                                               'date'
         16        SEND_VAL                                                 'M+j%2C+Y'
         17        SEND_VAR                                                 !1
         18        DO_ICALL                                         $6      
         19      > RETURN                                                   $6
   17    20*     > RETURN                                                   null

End of function formatdate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.57 ms | 1402 KiB | 18 Q