I have the below function which checks if there are any values in two variables and then adds them up, or tells you if there aren't any. It actually works totally fine, BUT it also returns warnings for undefined variables when I leave them empty. Can anyone explain why this is? and how I can correct it?
I have searched but perhaps because of my lack of general knowledge on the subject I couldn't search efficiently.
function add_up($first, $second){
if($first == "" and $second == ""){
return 'No numbers';}
else {
return $first + $second;
}
}
echo add_up();