I very confused now. I have the dimensional array and I want to search and also show each data. This is my array:
Array(
[0] => Array(
[unknowndata] => Array(
[id] => 00001
[content] => some text here
)
)
[1] => Array(
[realdata] => Array(
[id] => 00001
[content] => abcdefg
)
)
[2] => Array(
[realdata] => Array(
[id] => 00002
[content] => abcd
)
)
)
My question is
how to show only the realdata
if the key is different (in the example, the unknowndata
is in array[0], how if the unknowndata
is in array[n])
how to process the content of realdata
(if the content is abcd
return true
else return false
)
Is that what you want?
foreach($yourarray as $element){
if(array_key_exists("realdata",$element)) {
echo $element['realdata']['content'];
}
}