Jump to content

How to check array is empty?


jwhite68

Recommended Posts

I have an array:

 

$errs = array();

 

And in the code, I want to check if the array has any values assigned to its elements.

e.g. if $errs[1] or $errs[2] have been set to values then its not empty.  But if no elements (ie no keys) have been assigned to the array, how can I easily check for this?

I think I have been through the various array functions in PHP and couldnt see anything obvious.

 

Link to comment
https://forums.phpfreaks.com/topic/60926-how-to-check-array-is-empty/
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.