i have this array
the name of array is $list
when i type this:
$mychild = $list[1]['children'];
but if there is no child i get this message
A PHP Error was encountered
Severity: Notice
Message: Undefined index: children
Filename: controllers/user.php
Line Number: 384
how i can check if there is child in array items?
Array
(
[0] => Array
(
[id] => 7
[children] => Array
(
[0] => Array
(
[id] => 9
)
)
)
[1] => Array
(
[id] => 6
)
[2] => Array
(
[id] => 8
)
[3] => Array
(
[id] => 10
)
)
or
See
isset()andarray_key_exists()