Quote Originally Posted by melbin View Post
http://php.flashwebhost.com/melbin/days.php

PHP Code:
<?php
$day
='Sunday';
if (
$day="Sunday") {
    echo 
'Have a nice Sunday';
}

else {
    echo 
'Have a nice day';
}
In this code when i use == on line no:3 i am getting the result as FALSE. Why ?

Doubt 2

Is it possible to get the day by using PHP date and time function ?
i used ur code and found no error even when i used == in line 3.

and
Code:
if ($day="Sunday")
is a wrong code. bez in this you are give $day the value "Sunday",and in this case the if-statement will be always executed.

check as
Code:
if($day = 'monday')
in this code too the if statement will be execute bez all you doing is telling the compiler that the value of $day variable is now 'monday' and not to check if $day is equal to 'monday'.

x == y;
tells the compiler to check if left hand side (x) of [ == ] is equal to the right hand side (y).

x=y;
tells the compiler that now the value of y is to given to x also.

i think the point is clear..