Given an array of $a = array("Hello","World") and $a[0] holds Hello and $a[0][0] holds value H, is it correct to say that $a is a "Multidimensional String Array"?
2 Answers
No, $a is a 1-dimensional array. Period.
Although strings can be accessed/modified by character using index notation, and are implemented internally as character sequences, PHP strings are not true PHP arrays.
1 Comment
hakre
it has been called substring access in the past.
Is it correct to say that $a is now a Multidimensional String Array?
Ask your PHP:
foreach($a[0] as $char);
and see what does it say.
1 Comment
Aditya M P
Invalid argument supplied for foreach(), so it's not an array.
$a[0][0][0][0][0]is stillH. And$a[0]['foo']['bar']is stillH(on < 5.4). Just because it looks like an array, doesn't mean it is one...