3v4l.org

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

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

End of function formatdate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.85 ms | 1403 KiB | 18 Q