PHP Empty

Posted The: 04/06/2009 At: 20:16

Contents:

The Empty function of php, checks whether a variable is Empty or not.

The following is considered to be Empty.

"" An empty String
0 Zero declared as an Integer
0 Zero declared as a String
NULL The constant NULL
FALSE The keyword FALSE
var $MyVar; Declared variables with no value.

Example

Below is using a PHP If statement, to check if a variable was Empty.

if (empty($var)) {
    echo '$MyVar is considered Empty';
}

Comments: [0]

© Brugbart Webdesign