This is a discussion on what is the Difference between isset() and empty() . within the PHP Programming forums, part of the Web Development category; hi, what is the Difference between isset() and empty() ....
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
| |||
| hi, isset() - will tell you is a varaible has been defined. Sometimes it will return true even if the varable has an empty value. empty() - check for the value is set for the variable. it returns true if the value is "0" For some PHP type comparison please see this PHP: PHP type comparison tables - Manual
__________________ With, J. Jeyaseelan Everything Possible |
| |||
| Isset() checks if a variable has a value including ( Flase , 0 , or Empty string) , But not NULL. Returns TRUE if var exists; FALSE otherwise. On the other hand the empty() function checks if the variable has an empty value empty string , 0, NULL ,or False. Returns FALSE if var has a non-empty and non-zero value. Comparison example on both isset() and empty() <?php $var = 0; // Evaluates to true because $var is empty if (empty($var)) { echo '$var is either 0, empty, or not set at all'; } // Evaluates as true because $var is set if (isset($var)) { echo '$var is set even though it is empty'; } ?> For more information and examples visit the following links. PHP: isset - Manual PHP: empty - Manual |
![]() |
| Thread Tools | |
| Display Modes | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to remove empty or null rows from a dataview | it.wily | C# Programming | 2 | 02-10-2008 07:34 AM |
| Empty a recycle bin in C# | garunprasad | C# Programming | 2 | 08-25-2007 02:56 AM |
| Outlook - Mail subject empty alert | priyan | Microsoft | 1 | 07-11-2007 07:57 AM |