Inside the begining of a function I have this:
if(false);
{
return 'TRUE';
}
it is returning "TRUE"! Obviously my real use was checking a more useful expression and returning something else. I just changed it to this to elaborate my point.
Why is this happening? Can you not put a return inside an if statement? I do this all the time in other languages.
For example
instead of this:
function () {
if(something)
{
//process stuff
}
}
which requires wraping everthing inside the function inside an if.
I prefer to do this:
function() {
if(!something)
return;
//process stuff
}
Is this not OK in PHP... is there a work around? Or am I just crazy?