I have an array like below which is generated by parsing a xml url.
The array is
Array
(
[Tags] => SimpleXMLElement Object
(
[0] =
I understand what you want. You want to check every data of the array if all of it is empty or at least 1 is not empty
Empty array
Array ( [Tags] => SimpleXMLElement Object ( [0] => ) )
Not an Empty array
Array ( [Tags] => SimpleXMLElement Object ( [0] =>,[1] => "s" ) )
I hope I am right. You can use this function to check every data of an array if at least 1 of them has a value.
/*
return true if the array is not empty
return false if it is empty
*/
function is_array_empty($arr){
if(is_array($arr)){
foreach($arr $key => $value){
if(!empty($value) || $value != NULL || $value != ""){
return true;
break;//stop the process we have seen that at least 1 of the array has value so its not empty
}
}
return false;
}
}
if(is_array_empty($result['Tags'])){
//array is not empty
}else{
//array is empty
}
Hope that helps.