Consider a function that explicitly returns null:
function nullreturn() {return null;}
$rv = nullreturn();
var_dump($rv);
var_dump(isset($rv));
var_dump(is_null($rv));
Which identifies as null -- as expected.
NULL
bool(false)
bool(true)
And consider a function with no return value -- or even a return statement:
function noreturn() {}
$rv = noreturn();
var_dump($rv);
var_dump(isset($rv));
var_dump(is_null($rv));
Which also identifies as null:
NULL
bool(false)
bool(true)
... is there a way to determine that noreturn returns "nothing" instead of null?
As to why I need this null/void distinction, I've just been trying to achieve compatibility with a previous service implementation that did make this distinction and which includes tests for it. But, it's probably not critical. I just don't want to strip away the relevant tests and hope I wasn't depending on the distinction if I were overlooking an achievable solution.
functionnotprocedure. If you rememberpascal-language. It has two major types of subroutines -functionthat returns a typed value andprocedurethat returns nothing. It hides inside the wordfunction.sinis math-function,cosis math-function - both of them returns a value. PHP doesn't have any other major types of subroutines. :).. In any casefunctionisfunction, itmustreturns a value, imho. I think this text is kind of offtop .. sry :)