Comparison Operator ( !== )

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Comparison Operator ( !== )

Post by dstefani »

Ok, I'm stupid.

I use it, it works, but what is it really doing.
I can't find it in the manual other than in the readdir() section.

It seems it would mean NOT identical. But what about this:

Code: Select all

while (false !== ($file = readdir($handle)))
"while this statement is not false" right?

Can you point me to the description od this operator?

Thanks,

-D
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Check out:
http://www.php.net/manual/en/language.o ... arison.php
php.net wrote:$a !== $b -> Not identical -> TRUE if $a is not equal to $b, or they are not of the same type. (PHP 4 only)
Mac
User avatar
dstefani
Forum Contributor
Posts: 140
Joined: Sat Jan 11, 2003 9:34 am
Location: Meridian Idaho, USA

Post by dstefani »

Oh, like in the list I was looking at before I posted this.

See I told you I was stupid! ;>)

Thanks!
User avatar
lazy_yogi
Forum Contributor
Posts: 243
Joined: Fri Jan 24, 2003 3:27 am

Post by lazy_yogi »

anyone see an advantage of

Code: Select all

while (false !== ($file = readdir($handle)))
over

Code: Select all

while ($file = readdir($handle))
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

place a file called 0 in your directory and you will see ;)
or simply try

Code: Select all

<?php
$f = '0';
echo ($f) ? 'true' : 'false', ' ';
echo ($f !== FALSE) ? 'true' : 'false', ' ';
?>
despite that: no, not to my knowledge ;)
Post Reply