Re: [PHP] exit() function question
Hi, Wednesday, September 4, 2002, 1:30:49 AM, you wrote: RL> Why exit() funtion always exit with 255 value instead of the passed RL> value, in php 4.2.2, even when I compile with --enable-cli. RL> Check the code bellow, to see RL> # cat t3.php RL> #!/usr/src/php-4.2.2/php RL> echo "Version: ",phpversion(),"\n"; RL> exit(1); ?>> RL> # ./t3.php ; echo "last run exit value:"$? RL> Version: 4.2.2 RL> last run exit value:255 Try changing the commas to dots like echo "Version: ".phpversion()."\n"; -- regards, Tom -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Exit Function
> What is the way to exit a function? For example: > function FooBar() { > if ($foo = $bar) > Exit_this_Function; > ## otherwise execute the rest of this function > } function FooBar() { if ($foo = $bar) return 0; } ## otherwise execute the rest of this function } Chris
Re: [PHP] Exit Function
El Mié 31 Ene 2001 19:34, Karl J. Stubsjoen escribió: > What is the way to exit a function? For example: > > function FooBar() { > > if ($foo = $bar) > Exit_this_Function; > > ## otherwise execute the rest of this function > } return is what you want. -- System Administration: It's a dirty job, but someone told I had to do it. - Martín Marqués email: [EMAIL PROTECTED] Santa Fe - Argentinahttp://math.unl.edu.ar/~martin/ Administrador de sistemas en math.unl.edu.ar - -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Exit Function
function some($foo, $bar) { if ($foo != $bar) return ; ... } -- Chris Lee Mediawaveonline.com [EMAIL PROTECTED] ""Karl J. Stubsjoen"" <[EMAIL PROTECTED]> wrote in message 004701c08bd5$eecbc340$0afc020a@kstubsjoen">news:004701c08bd5$eecbc340$0afc020a@kstubsjoen... > What is the way to exit a function? For example: > > function FooBar() { > > if ($foo = $bar) > Exit_this_Function; > > ## otherwise execute the rest of this function > } > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Exit Function
On Wed, 31 Jan 2001, Karl J. Stubsjoen wrote: > What is the way to exit a function? For example: > > function FooBar() { > > if ($foo = $bar) > Exit_this_Function; > > ## otherwise execute the rest of this function > } Use "return". If you want your function to return a value, you can use the syntax: return value; Hope this helps, --Steve Hi! I'm a .signature virus! Copy me into yours and join the fun! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] Exit Function
by the way, if ($foo = $bar) will return true simply if $bar is not null, i think you want if ($foo == $bar) thought I'd point that out, cause if you don't know return that nasty one would probably bite you on the ass next :) Gfunk - http://www.gfunk007.com/ I sense much beer in you. Beer leads to intoxication, intoxication to hangovers, and hangovers to... suffering. - Original Message - From: "Steve Smith" <[EMAIL PROTECTED]> To: "Karl J. Stubsjoen" <[EMAIL PROTECTED]> Cc: "PHP Mailing List" <[EMAIL PROTECTED]> Sent: Thursday, February 01, 2001 9:39 AM Subject: Re: [PHP] Exit Function > On Wed, 31 Jan 2001, Karl J. Stubsjoen wrote: > > > What is the way to exit a function? For example: > > > > function FooBar() { > > > > if ($foo = $bar) > > Exit_this_Function; > > > > ## otherwise execute the rest of this function > > } > > > Use "return". If you want your function to return a value, you > can use the syntax: return value; > > Hope this helps, > > --Steve > > Hi! I'm a .signature virus! Copy me into yours and join the fun! > > > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > To contact the list administrators, e-mail: [EMAIL PROTECTED] > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]