Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

holy shit php sucks and is written by idiots

Name: Anonymous 2012-12-20 18:46

https://bugs.php.net/bug.php?id=54547

Please have a look at the comments by abakobob and myself ("nikic@php.net"). They explain why such behavior is actually good, in most cases.

Name: Anonymous 2012-12-21 14:27


If you wonder how to end execution of a function (as I did), it's that simple: return

function foo($a) {
 if(!$a) return;
 echo 'true';
 // some other code
}

foo(true) will echo 'true', foo(false) won't echo anything (as return ends execution of the function. Of course, therefore there is no need for 'else' before 'echo').

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List