On Tue, 2004-01-20 at 22:39, Luke wrote:
> yeah its strange,
>
> $test is equal to $test2,
> $test is equal to $test3
> but $test2 is not equal to $test3,
>
> $test = "string";
> $test2 = true;
> $test3 = 0;
> if($test == $test2){
> echo "hi";
> }
>
Looks fine to me...
$test == $test2: $test is not an empty string and thus evaluates to
true.
$test == $test3: $test is converted to an integer to compare against
$test3. Conversion of $test to integer results in 0,
which happens to be equal to $test3
You should read the section on type juggling.
http://ca2.php.net/language.types.type-juggling
Cheers,
Rob.
--
.------------------------------------------------------------.
| InterJinn Application Framework - http://www.interjinn.com |
:------------------------------------------------------------:
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`------------------------------------------------------------'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php