Antony Dovgal wrote:
On 25.10.2005 19:39, Ants Aasma wrote:

It currently is equal:
$ php -r 'var_dump(null == array()); var_dump((array) null);'
bool(true)
array(0) {
}

No, there aren't equal.
Use === and you'll see the difference.

At least the manual says that the == operator is named equal and the === operator is named identical. Actually I wanted to point out that null is a bit of a special case in PHP: $ php -r 'var_dump(null == 0); var_dump(null == array()); var_dump(0 == array());'
bool(true)
bool(true)
bool(false)
$ php -r 'var_dump((array) ""); var_dump((array) 0); var_dump((array) null);'
array(1) {
  [0]=>
  string(0) ""
}
array(1) {
  [0]=>
  int(0)
}
array(0) {
}

+-0 on the foreach issue, but with the SPL Iterators I can see where Marcus is coming from.

Ants

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to