Re: string vs number
| From: | Nathan Nobbe | Date: | Tue, 05 Feb 2008 18:53:24 +0000 |
| Subject: | Re: string vs number | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-268739@lists.php.net to get a copy of this message | ||
On Feb 5, 2008 1:50 PM, Casey <heavyccasey@gmail.com> wrote:
> I believe this is the difference with arrays:
>
> $a = array(2 => "foo");
> Array(0 => null, 1 => null, 2 => "foo")
>
> $a = array("2" => "foo");
> Array("2" => "foo")
>
i think the implicit type casting applies there as well:
php > $meh = array(2=>4);
php > echo $meh['2'];
4
php > $meh['2'] = 5;
php > echo $meh['2'];
5
php > echo $meh[2];
5
-nathan