3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo $phpdate = strtotime('-1 day'); echo PHP_EOL; echo $mysqldate = date('Y-m-d H:i:s', $phpdate); function d($phpdate) { if(date('Y-m-d') == date('Y-m-d', $phpdate)) { echo 1; return 'Today at ' . date("g:i A", $phpdate); } else if(date('Y-m-d', strtotime('-1 day')) == date('Y-m-d', $phpdate)) { echo 2; return "Yesterday at" . date("g:i A", $phpdate); } else { echo 3; return date("m-d-Y g:ia", $phpdate); } } echo d($phpdate); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LsCRR
function name:  (null)
number of ops:  17
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        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
   24    12        INIT_FCALL                                               'd'
         13        SEND_VAR                                                 !0
         14        DO_FCALL                                      0  $6      
         15        ECHO                                                     $6
   27    16      > RETURN                                                   1

Function d:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 18
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 43) Position 1 = 31, Position 2 = 39
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 39
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LsCRR
function name:  d
number of ops:  46
compiled vars:  !0 = $phpdate
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'date'
          2        SEND_VAL                                                 'Y-m-d'
          3        DO_ICALL                                         $1      
          4        INIT_FCALL                                               'date'
          5        SEND_VAL                                                 'Y-m-d'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $2      
          8        IS_EQUAL                                                 $1, $2
          9      > JMPZ                                                     ~3, ->18
   10    10    >   ECHO                                                     1
   11    11        INIT_FCALL                                               'date'
         12        SEND_VAL                                                 'g%3Ai+A'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $4      
         15        CONCAT                                           ~5      'Today+at+', $4
         16      > RETURN                                                   ~5
         17*       JMP                                                      ->45
   13    18    >   INIT_FCALL                                               'date'
         19        SEND_VAL                                                 'Y-m-d'
         20        INIT_FCALL                                               'strtotime'
         21        SEND_VAL                                                 '-1+day'
         22        DO_ICALL                                         $6      
         23        SEND_VAR                                                 $6
         24        DO_ICALL                                         $7      
         25        INIT_FCALL                                               'date'
         26        SEND_VAL                                                 'Y-m-d'
         27        SEND_VAR                                                 !0
         28        DO_ICALL                                         $8      
         29        IS_EQUAL                                                 $7, $8
         30      > JMPZ                                                     ~9, ->39
   14    31    >   ECHO                                                     2
   15    32        INIT_FCALL                                               'date'
         33        SEND_VAL                                                 'g%3Ai+A'
         34        SEND_VAR                                                 !0
         35        DO_ICALL                                         $10     
         36        CONCAT                                           ~11     'Yesterday+at', $10
         37      > RETURN                                                   ~11
         38*       JMP                                                      ->45
   18    39    >   ECHO                                                     3
   19    40        INIT_FCALL                                               'date'
         41        SEND_VAL                                                 'm-d-Y+g%3Aia'
         42        SEND_VAR                                                 !0
         43        DO_ICALL                                         $12     
         44      > RETURN                                                   $12
   21    45*     > RETURN                                                   null

End of function d

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.47 ms | 1402 KiB | 18 Q