How to check if an array contains a empty element or value

Use the following code example

$array = array('a','b',''); //The array to check for empty values
echo (in_array('  ', $array)) ? 'Empty values exists' :'No empty values'; ?> //Checking if empty values exist in the array


in_array = searches a array for a specific value

Image Credits: Photo by Isis França on Unsplash.

More Similar Posts

No results found.