[PHP] Re: !== (was Re: [PHP] how many files are in a directory)

2002-08-14 Thread Justin Garrett

Here is an example that might help.

$a = 1;

if($a)
echo '1';

if($a == true)
echo '2';

if($a === true)
echo '3';

The first and second conditional statements execute but the third doesn't.
This is because $a evaluates to true but is not of type 'boolean'.  === and
!== not only compare value but type as well.

Justin Garrett

"Chris Boget" <[EMAIL PROTECTED]> wrote in message
07bb01c243c2$1b3045a0$8c01a8c0@ENTROPY">news:07bb01c243c2$1b3045a0$8c01a8c0@ENTROPY...
> > // Note that !== did not exist until 4.0.0-RC2
>
> I took a quick look at the docs to find out what !== meant
> (because I'd never seen it before).  I'm not sure I understand
> what it's use is.  Could someone explain why you would use
> it and for what purpose?
> I couldn't really infer from the example that was included in
> the previous message.
>
> thnx,
> Chris
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] !== (was Re: [PHP] how many files are in a directory)

2002-08-14 Thread Jay Blanchard

[snip]
> // Note that !== did not exist until 4.0.0-RC2

I took a quick look at the docs to find out what !== meant
(because I'd never seen it before).  I'm not sure I understand
what it's use is.  Could someone explain why you would use
it and for what purpose?
[/snip]

$a !== $b Not identical TRUE if $a is not equal to $b, or they are not the
same data type

$a = 2
$b = "2"
If $a and $b are not the same data type they ARE NOT IDENTICAL
$a is an integer, $b is a string

or

$a = 2
$b = 3

They are the same data type (integer), but they ARE NOT EQUAL

I would use strcomp() to compare strings against other strings though, since
data types like this may cause problems since PHP variables are loosely
typed.

HTH!

Jay



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[PHP] !== (was Re: [PHP] how many files are in a directory)

2002-08-14 Thread Chris Boget

> // Note that !== did not exist until 4.0.0-RC2

I took a quick look at the docs to find out what !== meant
(because I'd never seen it before).  I'm not sure I understand
what it's use is.  Could someone explain why you would use
it and for what purpose?  
I couldn't really infer from the example that was included in
the previous message.

thnx,
Chris



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] how many files are in a directory

2002-08-14 Thread Bas Jobsen

Op woensdag 14 augustus 2002 20:00, schreef Harry.de:
> does anybody now a way in php to read out,
> how many files are in a directory




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php