Reputation: 1810
<?php
echo $Variable;
?>
**// I would like to check if the variable is empty, using but if() statements but more secure than...**
if($var == "")
is it possible to check if variable is empty more secure than this ?
Upvotes: 2
Views: 2940
Reputation: 654
if(!isset($var) || $var == "")
{
//$var is empty.
}
^ Thats what I use, it also covers if you haven't 'initialised' it yet.
*edit - to reflect comments
Upvotes: 6