Results 1 to 25 of 25
Thread: if($var) vs. if(isset($var))
Oct 22, 2012, 04:37 #1
- Join Date
- Nov 2009
- 0 Post(s)
- 0 Thread(s)
if($var) vs. if(isset($var))
When checking whether the submit button is pressed or not,
if I use
When checking whether the username and password fields are empty or not, both of the following works fine.
if (isset($_POST['username']) && isset($_POST['password']))
if ($_POST['username'] && $_POST['password'])
My question is, should I always use isset() for checking variables or is it ok not to use it where it is not required?