How do I find if an array has one or more elements?
I need to execute a block of code where the size of the array is greater than zero.
if ($result &
count — Count all elements in an array, or something in an object
count
int count ( mixed $array_or_countable [, int $mode = COUNT_NORMAL ] )
Counts all elements in an array, or something in an object.
Example:
In your case, it is like:
if (count($array) > 0) { // Execute some block of code here }