RE: [PHP] Variables
| From: | Don Read | Date: | Wed, 11 Jul 2001 02:31:36 +0000 |
| Subject: | RE: [PHP] Variables | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-57294@lists.php.net to get a copy of this message | ||
On 11-Jul-01 James Bartlett wrote:
> 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?
>
if ($text1 == $text2)
if (0 == strcmp(text1, $text2))
RTM
http://www.php.net/manual/en/language.operators.assignment.php
http://www.php.net/manual/en/language.operators.comparison.php
--
Don Read dread@texas.net
-- It's always darkest before the dawn. So if you are going to
steal the neighbor's newspaper, that's the time to do it.