Same as with two numerical values... use the == operator

if($text1 == $text2) /* only true if the 2 vars are equal */

if($text1 = $text2) /* this sets $text1 to the same value as text2 and is
always true unless $text2 = false */

http://php.net/manual/en/language.operators.comparison.php

----- Original Message -----
From: "James Bartlett" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, July 10, 2001 7:12 PM
Subject: [PHP] Variables


Hi,

This might sound really simple but plz humour me :)

How can I tell if two text variables are equal to one another?

If I use..

if($text1 = $text2)
{
echo "The variables are equal";
}
else
{
echo "The variables are not equal";
}

then the code in the else state is always printed even if I know for a fact
that the variables are equal...

Any suggestions?

James



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to