How To Banking Concern Gibe If An Array Is Empty Inwards Php?

You tin utilization PHP inbuilt functions; array_filter() in addition to empty() to depository fiscal establishment tally if an array is empty.

array_filter() function's default demeanour volition take away all values from array which are equal to null, 0, '' or false. Otherwise inwards your detail example empty() laid upwardly volition e'er supply truthful if at that spot is at to the lowest degree ane chemical component fifty-fifty amongst "empty" value.

empty() role checks to run across whether the variable is empty, null, false, or a representation of zero. It doesn't supply truthful simply because the value associated amongst an array entry is false.

 $errors = array_filter($_POST);  if (empty($errors)) {   echo "array is empty."; } else {  echo "It is non empty."; } 
Ref: http://stackoverflow.com/a/8329005
Sumber http://developer-paradize.blogspot.com

Comments

Popular posts from this blog

What Are The Main Components of a Computer System

Top Qualities To Look For In An IT Support Team

How To Integrate Google Adwords Api Into Codeigniter?