Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to differentiate isset and empty

Answer Posted / amit

isset() will ONLY return true when the value of the variable
is not NULL (and thereby the variable is at least defined).

empty() will return true when the value of the variable is
deemed to be an "empty" value, typically this means 0, "0",
NULL, FALSE and empty string, anything else is not empty.

Some examples


FALSE == isset($foo);
TRUE == empty($foo);
$foo = NULL;
FALSE == isset($foo);
TRUE == empty($foo);
$foo = 0;
TRUE == isset($foo);
TRUE == empty($foo);
$foo = 1;
TRUE == isset($foo);
FALSE == empty($foo);

Is This Answer Correct ?    21 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is php oop?

1059


Tell me can you extend a final defined class?

1124


Is learning php easy?

1056


Why use php artisan serve?

1018


Are react hooks stable?

1002


What is the use of trim in php?

1029


What is the function in PHP do not return a timestamp?

1073


Explain the difference between session and cookies in php?

1025


What is design pattern? Explain all including singleton pattern?

1034


What is needed to be able to use image function?

1088


Explain setcookie() function in php?

1076


Write a hello world program using variable?

1008


Where are the persistent cookies stored on your computer?

1040


What is the difference between Split and Explode in PHP?

1112


How to create reusable code in php?

1099