What happens when you take the value returned by a function that
doesn't return a value? For example,
function myfunc($myvar) {
if ($myvar == "xyzzy")
return(1);
return;
}
$abc = myfunc("def");
I know from my days of c programming that this would be very bad to
do. But php gives you so rope I'm wondering if you could just do an
isset($abc) to see if myfunc returned a value.
If so then we could write (scary) code where on an error condition
instead of returning something like -1 you just don't return a value.
doesn't return a value? For example,
function myfunc($myvar) {
if ($myvar == "xyzzy")
return(1);
return;
}
$abc = myfunc("def");
I know from my days of c programming that this would be very bad to
do. But php gives you so rope I'm wondering if you could just do an
isset($abc) to see if myfunc returned a value.
If so then we could write (scary) code where on an error condition
instead of returning something like -1 you just don't return a value.
Comment