On Fri, 28 Sep 2001, Markus Fischer wrote:
> What a nasty 'feature'. Can't we get rid of it ASAP?
Not really, it's how the Zend hash tables work. Every numeric key gets
converted to a number, even if it's used as a string value.
Derick
>
> It would allow comfty hash non-alpha key/value
> inserting(reassembling)
>
> - Markus
>
> On Fri, Sep 28, 2001 at 12:28:15PM -0000, [EMAIL PROTECTED] wrote :
> > ID: 13478
> > Updated by: derick
> > Reported By: [EMAIL PROTECTED]
> > Old Status: Open
> > Status: Bogus
> > Bug Type: Arrays related
> > Operating System:
> > PHP Version: 4.0.6
> > New Comment:
> >
> > This is not a bug, but a feature. All string indexes are converted to numbers if
>possible, even like this:
> > <?php
> > $a = array ('4' => "test");
> > print_r ($a);
> > ?>
> >
> > will show:
> >
> > Array
> > (
> > [4] => test
> > )
> >
> > Making it bogus
> >
> > Previous Comments:
> > ------------------------------------------------------------------------
> >
> > [2001-09-28 08:19:02] [EMAIL PROTECTED]
> >
> > Found in 4.0.7RC2 but probably present before. Array merge changes keys that are
>string-numeric. e.g.
> >
> > <?
> > $arr1 = array('1'=>'one', '2'=>'two');
> > $arr2 = array('a'=>'all');
> >
> > print_r(array_merge($arr1, $arr2));
> > ?>
> >
> > gives:
> >
> > Array ( [0] => one [1] => two [a] => all )
> >
> > A workaround kludge is to prefix string-numeric keys with a letter.
> >
> >
> > ------------------------------------------------------------------------
> >
> >
> >
> > Edit this bug report at http://bugs.php.net/?id=13478&edit=1
> >
> >
> > --
> > PHP Development Mailing List <http://www.php.net/>
> > To unsubscribe, e-mail: [EMAIL PROTECTED]
> > For additional commands, e-mail: [EMAIL PROTECTED]
> > To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
> --
> Markus Fischer, http://guru.josefine.at/~mfischer/
> EMail: [EMAIL PROTECTED]
> PGP Public Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
> PGP Fingerprint: D3B0 DD4F E12B F911 3CE1 C2B5 D674 B445 C227 2BD0
> -All your scripts are belong to Zend-
>
Derick Rethans
---------------------------------------------------------------------
PHP: Scripting the Web - www.php.net - [EMAIL PROTECTED]
SRM: Site Resource Manager - www.vl-srm.net
---------------------------------------------------------------------
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]