Hi,
ONe my friend told me that it's better to initialise any varialbles.
My question can i initialise any variables to empty.. like
Example one
if(!isset($_GET["op"])){
$op="";
}else{
$op=$_GET["op"];
}
Example two
$error="";
if(!$_POST["email"]){
$error="Email Address is missing";
}
// somewhere in the code i say.
if(!$error){
echo"NO errors found";
}else {
echo"Oops we found $error";
}
is the aove a good practice ??
just let you know that in the second example .. I could write the following code but in some case i want to do above style.
if(!$_POST["email"]){
echo" Email address is empty ";
}else {
echo" Everything is ok";
}