Jim,
I’m working on some PHP code to try to do what I was saying, but I really don’t know much PHP.
If this PHP code
if ($answer == "water")
means: if $answer = water, then how do you write if $answer doesn’t = water?
Thanks Jim,
Roger
Web Security and general support for tools found at AuditMyPC
Jim,
I’m working on some PHP code to try to do what I was saying, but I really don’t know much PHP.
If this PHP code
if ($answer == "water")
means: if $answer = water, then how do you write if $answer doesn’t = water?
Thanks Jim,
Roger
Copyright © Web Security.mobi All Rights Reserved. ·
Hi Roger,
In PHP a single equal sign is an assignment operator and used to assign a value to a variable. Two equal signs are a comparison operator, that is, it’s used to compare two values. So, in this case, we use two equal signs to compare the two items: $answer and ‘water’
<?
$answer = "water";
if($answer == "water")
echo "Water!";
else
echo "You need water!"
?>
or
<?
if($answer != "water")
echo "You need water!";
?>
Hope that helps