I have an array like:
$a = array(array('Hello','abc'), 'd');
var_dump($a);
array (size=2)
0 =>
array (size=2)
'title' => string 'Hello' (length=40)
'class' => string 'abc' (length=3)
1 => string 'd' (length=6)
var_dump($a[0]);
array (size=2)
'title' => string 'Hello' (length=40)
'class' => string 'abc' (length=3)
Why $a[0] is not empty? Anybody can point this out?
//Edit
I've tested that key 0 with this code:
If(empty($a[0]))
{
// Do A
}
else
{
// Do B
}
Why this return Do B?
This array
$a = array(array('Hello','abc'), 'd');
is equivalent to: $a = array(0 => array(0 => 'Hello', 1 => 'abc'), 1 => 'd');
PHP will substitute those keys.
0 comments:
Post a Comment