PHP | is_null() Function Last Updated : 05 Oct, 2021 Comments Improve Suggest changes Like Article Like Report The is_null() function is an inbuilt function in PHP which is used to find whether a variable is NULL or not. Syntax: boolean is_null ( $var ) Parameters: This function accepts a single parameter as shown in above syntax and described below. $var: Variable to check if it is NULL or not. Return value: It returns a boolean value. That is, it returns TRUE when $var will be NULL, otherwise it returns FALSE. Below programs illustrate the is_null() function in PHP: Program 1: PHP <?php // PHP code to demonstrate the working of is_null() function $var1 = NULL; $var2 = "\0"; // "\0" means "\0" $var3 = "NULL"; $var4 = 0; // $var1 has NULL value, so always give TRUE is_null($var1) ? print_r("True\n") : print_r("False\n"); // $var2 has '\0' value which consider as null in // c and c++ but here taken as string, gives FALSE is_null($var2) ? print_r("True\n") : print_r("False\n"); // $var3 has NULL string value so it will false is_null($var3) ? print_r("True\n") : print_r("False\n"); // $var4 is 0, gives FALSE is_null($var4) ? print_r("True\n") : print_r("False\n"); ?> Output: True False False False Program 2: PHP <?php // PHP code to demonstrate the working of // is_null() function function check_null($var) { return (is_null($var) ? "True" : "False"); } echo check_null(NULL) . "\n"; echo check_null(null) . "\n"; echo check_null(Null) . "\n"; echo check_null(NUll) . "\n"; echo check_null(NULl) . "\n"; echo check_null(nulL) . "\n"; echo check_null(nuLL) . "\n"; echo check_null(nULL) . "\n"; echo check_null(Nul) . "\n"; echo check_null(false) . "\n"; ?> Output: True True True True True True True True False False Reference: http://php.net/manual/en/function.is-null.php Comment More infoAdvertise with us Next Article PHP | is_null() Function M Mithun Kumar Follow Improve Article Tags : Misc Web Technologies PHP PHP-function Practice Tags : Misc Similar Reads PHP | is_link( ) Function The is_link() function in PHP used to check whether the specified file is a symbolic link or not. The path to the file is sent as a parameter to the is_link() function and it returns TRUE if the filename exists and is a symbolic link, otherwise it returns FALSE. Syntax: is_link(file) Parameters Used 2 min read PHP is_long() Function The is_long() function is an inbuilt function in PHP that is used to check whether the given value is a long integer or not. Syntax: bool is_long(mixed $value) Parameters: This function accepts a single parameter $value that holds the value which needs to check for a long integer. Return Value: This 1 min read PHP | is_numeric() Function The is_numeric() function is an inbuilt function in PHP which is used to check whether a variable passed in function as a parameter is a number or a numeric string or not. The function returns a boolean value. Syntax: bool is_numeric ( $var ) Parameters: The function accepts a single parameter which 2 min read PHP min( ) Function The min() function of PHP is used to find the lowest value in an array, or the lowest value of several specified values. The min() function can take an array or several numbers as an argument and return the numerically minimum value among the passed parameters. The return type is not fixed, it can b 2 min read PHP | is_a() function The is_a() is a built-in function in PHP and is used to check whether a given object is of a given class or not. It also checks if the given class is one of the parents of the given object or not. Syntax: boolean is_a($object, $class) Parameters: This function accepts two parameters as shown in the 2 min read PHP isset() Function The isset() function in PHP checks whether a variable is declared and not NULL. It returns true if the variable exists and has a non-NULL value, and false otherwise, without modifying the variable. Syntaxbool isset( mixed $var [, mixed $... ] )Parameters: This function accept one or more parameter a 3 min read PHP | is_dir( ) Function The is_dir() function in PHP used to check whether the specified file is a directory or not. The name of the file is sent as a parameter to the is_dir() function and it returns True if the file is a directory else it returns False. Syntax: is_dir($file) Parameters Used: The is_dir() function in PHP 1 min read PHP | is_iterable() Function The is_iterable() function is an inbuilt function in PHP which is used to check whether the contents of a variable is an iterable value or not. Syntax: bool is_iterable( mixed $var ) Parameters: This function accepts single parameter as mentioned above and described below: $var: It contains the valu 1 min read PHP | is_object() Function The is_object() function is an inbuilt function in PHP which is used to check whether the given value is an object or not. Syntax: bool is_object( mixed $var ) Parameters: This function accepts single parameter as mentioned above and described below: $var: It contains the value of variable that need 1 min read PHP is_file( ) Function The is_file() function in PHP is an inbuilt function which is used to check whether the specified file is a regular file or not. The name of the file is sent as a parameter to the is_file() function and it returns True if the file is a regular file else it returns False. Syntax: bool is_file($file) 2 min read Like