Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:19720 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 70348 invoked by uid 1010); 25 Oct 2005 16:51:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 70332 invoked from network); 25 Oct 2005 16:51:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 25 Oct 2005 16:51:58 -0000 X-Host-Fingerprint: 195.80.104.106 gw.mig.ee Received: from ([195.80.104.106:14238] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 06/4B-22886-EA26E534 for ; Tue, 25 Oct 2005 12:51:58 -0400 Message-ID: <06.4B.22886.EA26E534@pb1.pair.com> To: internals@lists.php.net Date: Tue, 25 Oct 2005 19:52:06 +0300 User-Agent: Mozilla Thunderbird 1.0.6 (X11/20050809) X-Accept-Language: en-us, en MIME-Version: 1.0 References: <425333877.20051025002259@marcus-boerger.de> <435E5579.20802@zend.com> In-Reply-To: <435E5579.20802@zend.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 195.80.104.106 Subject: Re: [PHP-DEV] foreach with null From: ants.aasma@mig.ee (Ants Aasma) 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