[Typo3-dev] suggestion for t3lib_div::xml2array()
Kasper Skårhøj
kasper at typo3.com
Mon Mar 29 14:33:06 CEST 2004
Try this:
$myArray=array(
'0' => 'green',
'1' => 'red',
2 => 'blue',
'brown',
'asdf' => 'string'
);
echo serialize($myArray);
echo $myArray[0];
echo $myArray['0'];
The output is:
a:5:{i:0;s:5:"green";i:1;s:3:"red";i:2;s:4:"blue";i:3;s:5:"brown";s:4:"asdf";s:6:"string";}greengreen
This shows:
- "echo $myArray[0];" and "echo $myArray['0'];" is the same!
- serialize() automatically sees '0' and 0 as an integer key in the
array - probably because PHP internally does so!
- kasper
On Mon, 2004-03-29 at 14:00, Martin T. Kutschker wrote:
> Kasper Skårhøj wrote:
> > In other words; if you set $myArray["1"] PHP apparently makes it
> > $myArray[1] automatically, right?
>
> Offhand I had said, no. But OTOH I've seen the same, at least the
> correct results for XML/array/TCE tell me this.
>
> I'm confused and need to check this. Perhaps some other folks have some
> knowledge on this point? I only hope there are version incompatibilities
> here.
>
> Masi
>
> _______________________________________________
> Typo3-dev mailing list
> Typo3-dev at lists.netfielders.de
> http://lists.netfielders.de/cgi-bin/mailman/listinfo/typo3-dev
--
Best regards
- kasper
---------------
"Zero MS-gravity" - finally migrated to Linux!
More information about the TYPO3-dev
mailing list