Re: [PHP] Will return break loop?
Thanks for really quick replies to my really quick question, everyone. Much appreciated. :) -Kevin - Original Message - From: "David Buerer" <[EMAIL PROTECTED]> To: "'Kevin Stone'" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Wednesday, September 11, 2002 3:42 PM Subject: RE: [PHP] Will return break loop? > really quik answer... > > yes. > > really long answer... > from php manual: > > "the return() statement immediately ends execution of the current function, > and returns its argument as the value of the function call." > > > -Original Message- > From: Kevin Stone [mailto:[EMAIL PROTECTED]] > Sent: Wednesday, September 11, 2002 2:57 PM > To: [EMAIL PROTECTED] > Subject: [PHP] Will return break loop? > > > Really quick question. Will "return" break a loop inside a function? > > Example.. > myfunc() > { > while($val=0) > { > if ($i=128) > { > return true; //<-break or no? > } > } > } > > I know I could easily figure this out my own but I do not have the means to > test it right now. :) > > Much thanks! > Kevin > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Will return break loop?
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On September 11, 2002 15:57, Kevin Stone wrote: > Really quick question. Will "return" break a loop inside a function? > > Example.. > myfunc() > { > while($val=0) > { > if ($i=128) > { > return true; //<-break or no? > } > } > } > > I know I could easily figure this out my own but I do not have the means to > test it right now. :) Yes - return will break a loop. Cheers! - --zak -BEGIN PGP SIGNATURE- Version: GnuPG v1.0.7 (GNU/Linux) iD8DBQE9f74qb6QONwsK8bIRAl+hAJwI4VaBj6IYtbjgHxGQkmq+Lg2iggCfYqOT gsTebidZ6s5u2tc5SC60IyM= =bywU -END PGP SIGNATURE- -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Will return break loop?
really quik answer... yes. really long answer... from php manual: "the return() statement immediately ends execution of the current function, and returns its argument as the value of the function call." -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 2:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Will return break loop? Really quick question. Will "return" break a loop inside a function? Example.. myfunc() { while($val=0) { if ($i=128) { return true; //<-break or no? } } } I know I could easily figure this out my own but I do not have the means to test it right now. :) Much thanks! Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Will return break loop?
I tested this on PHP 4.2.3 and in my case return does break a while loop. Jason -Original Message- From: Kevin Stone [mailto:[EMAIL PROTECTED]] Sent: Wednesday, September 11, 2002 3:57 PM To: [EMAIL PROTECTED] Subject: [PHP] Will return break loop? Really quick question. Will "return" break a loop inside a function? Example.. myfunc() { while($val=0) { if ($i=128) { return true; //<-break or no? } } } I know I could easily figure this out my own but I do not have the means to test it right now. :) Much thanks! Kevin -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php