I have written a function that returns data on success and false on failure.
I was wondering if this is considered a proper way of evaluating the return value in php.
function data(){
if($all_is_good){
return $data
}else{
return false;
}
}
$data = data(); //basically either a long series of strings or arrays
if(!$data){ //<-- this is the line I'm concerned about, is it safe to assume this?
echo 'oh no, bad stuff happened';
}
Thank you so much!