Logo

Programming-Idioms

History of Idiom 110 > diff from v14 to v15

Edit summary for version 15 by :
New PHP implementation by user [AgillaDev]

Version 14

2016-02-18, 16:58:03

Version 15

2016-02-23, 13:33:28

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Idiom #110 Check if string is blank

Set boolean blank to true if string s is empty, or null, or contains only whitespace ; false otherwise.

Code
if(empty($s) || is_null($s) || empty(trim($s))) {
  $blank = true;
}
else
{
  $blank = false;
}
Doc URL
http://php.net/manual/en/ref.strings.php