Re: PHP 4.0 Bug #9307 Updated: Numeric-looking array keys are forced to be integers
| From: | David Croft | Date: | Tue, 06 Mar 2001 15:06:29 +0000 |
| Subject: | Re: PHP 4.0 Bug #9307 Updated: Numeric-looking array keys are forced to be integers | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-48049@lists.php.net to get a copy of this message | ||
Even for array keys that are *not numbers*? How do I get a string for my
array key in this case?
On 6 Mar 2001, Bug Database wrote:
> ID: 9307
> Updated by: stas
> Reported By: david@php.net
> Old-Status: Open
> Status: Closed
> Bug Type: Scripting Engine problem
> Assigned To:
> Comments:
>
> Right, this is how PHP works. That's not a bug, that's an
> intended behaviour.
>
> Previous Comments:
> ---------------------------------------------------------------------------
>
> [2001-02-16 16:17:20] david@php.net
> <?
> $myarray['105'] = 'Hello';
> $myarray[(string)'106'] = 'Goodbye';
> var_dump($myarray);
> ?>
>
> array(2) {
> [105]=>
> string(5) "Hello"
> [106]=>
> string(7) "Goodbye"
> }
>
> It shouldn't be auto-converting array keys to numbers if they're already of a
> different type! Let's say I have an whole list of items as my array keys, and one just happens
> to be "able" to be converted into a number. Suddenly one of my array keys is no longer a
> string.
>
> ---------------------------------------------------------------------------
>
>
>
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://bugs.php.net/?id=9307&edit=2
>
>