Reputation: 55
if (isset($_GET['user_name']) && !empty($_GET['user_name']))
In the above code what is the use of the part - (isset($_GET['user_name'])
Upvotes: 0
Views: 569
Reputation: 31749
isset
will check if $_GET['user_name']
is set and is not NULL. But if you are using !empty($_GET['user_name'])
, there is no need for isset()
as empty()
will take care of it.
Only if (!empty($_GET['user_name']))
will check if $_GET['user_name']
is set and it contains a value.
NOTE: empty()
will return true
for -
Upvotes: 2