Vote count:
0
If the function validateCustomForm() returns nothing, then that means all of the variables are set. I tried using empty() but I figured since there is something in the function that it will always return false.
How can I check if a function returns something?
<?php
function validateCustomForm(){
$os0 = "";
$os1 = "5";
$os2 = "6";
$os3 = "5";
if(!empty($os0)){
//do nothing
}else{
$w = "width is missing";
echo $w;
}
if(!empty($os1)){
//do nothing
}else{
$h = "height is missing";
echo $h;
}
if(!empty($os2)){
//do nothing
}else{
$c = "color is missing";
echo $c;
}
if(!empty($os3)){
//do nothing
}else{
$q = "qty is missing";
echo $q;
}
}//end function
$valid = validateCustomForm();
if(!empty($valid)){
echo "something is missing";
} else{
echo "all good";
}
?>
asked 1 min ago
check if function returns something
Aucun commentaire:
Enregistrer un commentaire