3v4l.org

run code in 300+ PHP versions simultaneously
<?php $phpdate = strtotime('now'); $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/cBpJX
function name:  (null)
number of ops:  14
compiled vars:  !0 = $phpdate, !1 = $mysqldate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'strtotime'
          1        SEND_VAL                                                 'now'
          2        DO_ICALL                                         $2      
          3        ASSIGN                                                   !0, $2
    4     4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d+H%3Ai%3As'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   17     9        INIT_FCALL                                               'formatdate'
         10        SEND_VAR                                                 !0
         11        DO_FCALL                                      0  $6      
         12        ECHO                                                     $6
   19    13      > 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/cBpJX
function name:  formatDate
number of ops:  31
compiled vars:  !0 = $date
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    8     1        INIT_FCALL                                               'strtotime'
          2        SEND_VAL                                                 'today'
          3        DO_ICALL                                         $1      
          4        IS_SMALLER_OR_EQUAL                                      $1, !0
          5      > JMPZ                                                     ~2, ->13
    9     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
   10    13    >   INIT_FCALL                                               'strtotime'
         14        SEND_VAL                                                 'yesterday'
         15        DO_ICALL                                         $5      
         16        IS_SMALLER_OR_EQUAL                                      $5, !0
         17      > JMPZ                                                     ~6, ->25
   11    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
   13    25    >   INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'M+j%2C+Y'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $9      
         29      > RETURN                                                   $9
   15    30*     > RETURN                                                   null

End of function formatdate

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.89 ms | 1403 KiB | 18 Q