Created
August 13, 2025 18:12
-
-
Save kpirnie/c93bf874ccea0f07e0b4f05b849f8ef9 to your computer and use it in GitHub Desktop.
PHP - Is It Really Empty?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * is_it_empty | |
| * | |
| * Gets whether a variable is empty, null, or 'null' | |
| * | |
| * @since 7.4 | |
| * @access public | |
| * @static | |
| * @author Kevin Pirnie <[email protected]> | |
| * @package Kevin's Spam Stop | |
| * | |
| * @return bool Returns if the variable testing is empty, null, or 'null' | |
| * | |
| */ | |
| public static function is_it_empty( $_val ) : bool { | |
| // return from the test | |
| return ( ( empty( $_val ) ) || ( is_null( $_val ) ) || ( 'null' === $_val ) ) ?: false; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment