Jump to content

array if statment help?


jamesxg1

Recommended Posts

Hiya peeps,

 

I was wondering if anyone could help.

 

I have a search page that returns and array, if there are no results. It will either not exist or it will be empty. I was wondering how I would check this and if its not empty how I would count how many other arrays are inside it, as it will be array(array(1=>'1', 2=>'2')); if it is not empty, for instance.

 

if(empty($searchObj->compResult) OR !isset($searchObj->compResult)) {
echo 'its empty';
} else {
$count = count($searchObj->compResult);
}

 

Many thanks,

 

James.

Link to comment
https://forums.phpfreaks.com/topic/221159-array-if-statment-help/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.