Could anyone point me in the right direction as to returning the variable 'error' from a function....
Function - Check
function check($v1,$v2){
if($v1 == $v2){
// True
}else{
// False so run error_return function
error_return("Sorry, v1 and v2 do not match.");
}
}
Function - Ouput error
function error_return($var){
global $error;
$error = "<div class='error'>".$var."</div>";
return $error;
}
Where I would like to echo $error.
check("1","1");
echo $error;
Many thanks,
Ben