dimanche 4 août 2019

PHP If statement not working on date first statement always showing [duplicate]

This question already has an answer here:

I want to have a program that displays a certain phrase based on the day of the week, if it is friday, then it displays a certain phrase but when it is mon - thurs it displays a different phrase. Here is my code

<html>
<?php

$t=date('d-m-Y');
$time = date("D",strtotime($t));
echo $t;
echo $time;

if ($time = 'Fri')
{
  $delivery = 'All meals ordered today will be delivered on Monday.';
}else{
  $delivery = 'All meals ordered today will be delivered for tomorrow.';
}?>

<br><h1><?php echo $delivery;?>

The output always shows the first statement on the if statement.

Aucun commentaire:

Enregistrer un commentaire