You are viewing an old revision of this post, from March 15, 2015 @ 13:18:18. See below for differences between this version and the current revision.

How to test for empty strings in PHP

[php]//------------------------------------------------// // How to test for empty strings in PHP //------------------------------------------------// // http://www.texelate.co.uk/blog/how-to-test-for-empty-strings-in-php/ function strictEmpty($var) { // Delete this line if you want space(s) to count as not empty $var = trim($var); if(isset($var) === true && $var !== '') { // It's empty } else { // It's not empty } }[/php]

Revisions

  • March 15, 2015 @ 13:18:18 [Current Revision] by PeterLugg
  • March 15, 2015 @ 13:18:18 by PeterLugg

Revision Differences

There are no differences between the March 15, 2015 @ 13:18:18 revision and the current revision. (Maybe only post meta information was changed.)

Tags: ,

No comments yet.

Leave a Reply