Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:10637 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 99782 invoked by uid 1010); 19 Jun 2004 20:29:08 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 99741 invoked by uid 1007); 19 Jun 2004 20:29:08 -0000 Message-ID: <20040619202908.99738.qmail@pb1.pair.com> To: internals@lists.php.net References: <20040618162447.GP80292@bagend.shire> <20040618183418.85327.qmail@pb1.pair.com> <20040619063219.GX80292@bagend.shire> Date: Sat, 19 Jun 2004 06:28:52 -0700 Lines: 42 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 X-Posted-By: 64.142.6.231 Subject: Re: [PHP-DEV] Re: isset and unset behaviour From: pollita@php.net ("Sara Golemon") > so I'm taking that as double's are allowed, so the documentation > need's to reflect that, since it currently says integers or strings > are only allowed. > Sort of.....Strings and Integers *ARE* the only truly valid indices for arrays. Other types are loosely allowed using some basic translation criteria. Doubles get converted to longs in a floor() style behavior: i.e.: $a[1.1234] => $a[1], $a[980.829] => $a[980] Booleans are converted to either 0 or 1: i.e.: $a[false] => $a[0], $a[true] => $a[1] Resources are translated to their resource ID number: This is a little less obvious in its meaning. For example, if I $fp = fopen('foo.txt', 'r') it'll return a resource, if you var_dump($fp) that resource you might see something like: Resource #4 (stream). That "4" is the unique identifier of the resource that the variable points to. What this means for array indices is that: $a[$fp] => $a[4] I don't particularly care for the behavior of resources, but *eh* whatcha gonna do, it's probably there for BC reasons which go back to PHP3. Apart from the above, only string and integer types are allowed which are used untranslated: $a[7] => $a[7] $a['foo'] => $a['foo'] > And if so is this a php5 thing only or php4 also? > This particular translation bug existed in ZE1 (PHP4) as well. I MFH'd the fix already. -Sara