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

How to delete a file from the system?

1071


When to use inquire vs enquire?

985


How is it possible to return a value from a function?

1014


What are the different data types in javascript?

2071


What is a php form?

1017


What are php applications?

945


What is needed to be able to use image function?

1010


Explain how is it possible to cast types in php?

976


How to upload file in php?

1029


Write an example to remove html tags from a string in php?

924


How to track user logged out or not? When user is idle?

957


Write a program to display reverse of any number?

910


Why is php used?

1013


What's the difference between using mysql_ functions and pdo?

1159


What is the goto statement useful for?

1004