[Typo3-dev] PHP5
Christian Jul Jensen
christian at jul.net
Thu Apr 22 13:13:58 CEST 2004
Christian Jul Jensen <christian at jul.net> writes:
> That actually works, the only thing is, you still don't know if it's
> an array, but using that you could check it in only two calls:
>
> if(isset($my_array['some']['special']['value']['that']['i']['need']))
> &&
> is_array($my_array['some']['special']['value']['that']['i']['need']))
>
> instead of the horrible thing I posted earlier.
Unfortunately this was not right, I was a bit too quick on my
conclusions there.
<?php
$a = 'this is not an array';
if(isset($a['foo']))
print '1';
if(isset($a['foo']['bar']))
print '2';
if(isset($a['foo']['bar']['doo']))
print '3';
?>
Fatal error: Cannot use string offset as an array in
/var/www/sites/test.php on line 8
<?php
$a = 'this is not an array';
if(is_array($a['foo']))
print '1';
if(is_array($a['foo']['bar']))
print '2';
if(is_array($a['foo']['bar']['doo']))
print '3';
?>
Fatal error: Cannot use string offset as an array in
/var/www/sites/test2.php on line 6
Nice eh?
In my opinion this is a bug, and for me it doesn't make sense to do any
more about untill I know what will be the behavior in the final release.
--
Julle
More information about the TYPO3-dev
mailing list