+ 2

Could anyone tell me why we use isset() method in php

15th Jun 2017, 4:50 AM
Sagar Kumar
Sagar Kumar - avatar
5 Answers
+ 1
I think it's to check if a variable is set, for example.
15th Jun 2017, 5:03 AM
DamiĂŁo Brito
DamiĂŁo Brito - avatar
+ 1
<?php $var = ""; // variable set if (isset($var)) echo "it's true because the variable is set"; ?> you can also compare: if(isset($var) == ""){ echo "empty"; } else { echo "not empty"; } As I sad, the isset() method is to check if a variable IS SET.
15th Jun 2017, 6:10 AM
DamiĂŁo Brito
DamiĂŁo Brito - avatar
+ 1
got it😇
15th Jun 2017, 6:11 AM
Sagar Kumar
Sagar Kumar - avatar
0
like????
15th Jun 2017, 6:01 AM
Sagar Kumar
Sagar Kumar - avatar
0
To check if variable is set.
20th Jun 2017, 3:23 PM
Mladen Stankovic
Mladen Stankovic - avatar