Re: or return problem

From: Date: Tue, 07 Oct 2003 18:25:39 +0000
Subject: Re: or return problem
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-165342@lists.php.net to get a copy of this message
> Why won't any of you give a good reason why it won't work? How come this > works: > > function foo() { > 2+2==4 or die("The world is ending, or at least your processor!"); > } > > But this doesn't: > > function foo() { > 2+2==4 or return("The world is ending, or at least your processor!"); > } > > The way I see it, there's something really odd going on here. Directly from the docs: http://ca3.php.net/manual/en/function.return.php First line: "If called from within a function, the return() statement immediately ends execution of the current function" Important concept: IMMEDIATELY returns. Learn to read. Rob. -- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

« previous php.general (#165342) next »