RE: [PHP] Break, Exit, Die, Kill, Maime and Stab
I have added returns to where I had originally added breaks and it works perfectly. The included code is executed till return is called and then the included script is no longer executed. Jonathan So...why not write the entire included file as a function and then call that function instead of using include? I'd be interested, though, to hear if the return broke out of the include. -- Jeff Moser Web Developer ihigh Inc. / Host Interactive 859.232.8282 -- -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 5:10 AM To: 'Jim Lucas'; Jonathan Pitcher; [EMAIL PROTECTED] Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 22:47 Technically you are not outside of a function. you need to use one of the include or require functions to include the file right? include and require are not functions -- they are language constructs. (Proof: include 'file.inc'; works.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- 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] Break, Exit, Die, Kill, Maime and Stab
Make it be: if () { include(); } else { if () { include(); } else if () { include(); } } reads much better. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Break, Exit, Die, Kill, Maime and Stab
-Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 22:47 Technically you are not outside of a function. you need to use one of the include or require functions to include the file right? include and require are not functions -- they are language constructs. (Proof: include 'file.inc'; works.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Break, Exit, Die, Kill, Maime and Stab
So...why not write the entire included file as a function and then call that function instead of using include? I'd be interested, though, to hear if the return broke out of the include. -- Jeff Moser Web Developer ihigh Inc. / Host Interactive 859.232.8282 -- -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 5:10 AM To: 'Jim Lucas'; Jonathan Pitcher; [EMAIL PROTECTED] Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 22:47 Technically you are not outside of a function. you need to use one of the include or require functions to include the file right? include and require are not functions -- they are language constructs. (Proof: include 'file.inc'; works.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Break, Exit, Die, Kill, Maime and Stab
-Original Message- From: Jeff Moser [mailto:[EMAIL PROTECTED] Sent: 03 July 2003 13:07 So...why not write the entire included file as a function and then call that function instead of using include? I'd be interested, though, to hear if the return broke out of the include. Well, it damn well better, as the manual page at http://www.php.net/include says it does! (You can return a value, as well, if you really must.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Break, Exit, Die, Kill, Maime and Stab
i works for me in many different areas on my site Jim Lucas - Original Message - From: Jeff Moser [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, July 03, 2003 5:07 AM Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab So...why not write the entire included file as a function and then call that function instead of using include? I'd be interested, though, to hear if the return broke out of the include. -- Jeff Moser Web Developer ihigh Inc. / Host Interactive 859.232.8282 -- -Original Message- From: Ford, Mike [LSS] [mailto:[EMAIL PROTECTED] Sent: Thursday, July 03, 2003 5:10 AM To: 'Jim Lucas'; Jonathan Pitcher; [EMAIL PROTECTED] Subject: RE: [PHP] Break, Exit, Die, Kill, Maime and Stab -Original Message- From: Jim Lucas [mailto:[EMAIL PROTECTED] Sent: 02 July 2003 22:47 Technically you are not outside of a function. you need to use one of the include or require functions to include the file right? include and require are not functions -- they are language constructs. (Proof: include 'file.inc'; works.) Cheers! Mike - Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- 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] Break, Exit, Die, Kill, Maime and Stab
At 14:35 3-7-2003, you wrote: -Original Message- From: Jeff Moser [mailto:[EMAIL PROTECTED] Sent: 03 July 2003 13:07 So...why not write the entire included file as a function and then call that function instead of using include? I'd be interested, though, to hear if the return broke out of the include. Mike Ford: Well, it damn well better, as the manual page at http://www.php.net/include says it does! (You can return a value, as well, if you really must.) ah that's interesting. another option using multiple returns in one function: function testvars($var1,$var2) { if ($var11) return 'var1 must be a positive integer'; if ($var2=='bad') return 'var2 is bad!'; //this line is only reached when all vars are tested ok: return true; } $result=testvars($var1,$var2); if ($result!=true) { echo $result.'brPlease warp to your previous location'; exit(); } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Break, Exit, Die, Kill, Maime and Stab
On Jul 2, 2003, Jonathan Pitcher claimed that: |I have some scripting that includes files. The included files are |executed and everything works great. | |The included page needs to check multiple information. | |Currently if I want the scripts to end correctly I have to: [snip] |I would love to: | |if() |{ | //Blah | break; |} | |and have that break only stop the rest of the execution of the include |file but allow the script that included it to finish running. | |I have tried break, exit and die with no luck. Even tried break 1; and |break 2; to break out of levels but that didn't seem to work either. | |Is there a solution or should I continue to do what I have done. | |Thanks in advance, | |Jonathan Pitcher Perhaps you might want to rewrite your code using the switch? http://www.php.net/switch -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Break, Exit, Die, Kill, Maime and Stab
return; will do the trick Jim Lucas - Original Message - From: Jonathan Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:09 PM Subject: [PHP] Break, Exit, Die, Kill, Maime and Stab I have some scripting that includes files. The included files are executed and everything works great. The included page needs to check multiple information. Currently if I want the scripts to end correctly I have to: if () { } else { if () { } else if () { } } You get the picture. Code gets hard to read with so many If's and Elses. I would love to: if() { //Blah break; } and have that break only stop the rest of the execution of the include file but allow the script that included it to finish running. I have tried break, exit and die with no luck. Even tried break 1; and break 2; to break out of levels but that didn't seem to work either. Is there a solution or should I continue to do what I have done. Thanks in advance, Jonathan Pitcher -- 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] Break, Exit, Die, Kill, Maime and Stab
I have thought about that but most of the information is not switchable. I use the code mostly for checking if a list of variables have been setup correctly. Thanks though. Jonathan On Wednesday, July 2, 2003, at 04:23 PM, Jeff Harris wrote: On Jul 2, 2003, Jonathan Pitcher claimed that: |I have some scripting that includes files. The included files are |executed and everything works great. | |The included page needs to check multiple information. | |Currently if I want the scripts to end correctly I have to: [snip] |I would love to: | |if() |{ | //Blah | break; |} | |and have that break only stop the rest of the execution of the include |file but allow the script that included it to finish running. | |I have tried break, exit and die with no luck. Even tried break 1; and |break 2; to break out of levels but that didn't seem to work either. | |Is there a solution or should I continue to do what I have done. | |Thanks in advance, | |Jonathan Pitcher Perhaps you might want to rewrite your code using the switch? http://www.php.net/switch -- Registered Linux user #304026. lynx -source http://jharris.rallycentral.us/jharris.asc | gpg --import Key fingerprint = 52FC 20BD 025A 8C13 5FC6 68C6 9CF9 46C2 B089 0FED Responses to this message should conform to RFC 1855. -- 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] Break, Exit, Die, Kill, Maime and Stab
return will work outside of functions ?? That I didn't know. Thanks, Jonathan On Wednesday, July 2, 2003, at 04:28 PM, Jim Lucas wrote: return; will do the trick Jim Lucas - Original Message - From: Jonathan Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:09 PM Subject: [PHP] Break, Exit, Die, Kill, Maime and Stab I have some scripting that includes files. The included files are executed and everything works great. The included page needs to check multiple information. Currently if I want the scripts to end correctly I have to: if () { } else { if () { } else if () { } } You get the picture. Code gets hard to read with so many If's and Elses. I would love to: if() { //Blah break; } and have that break only stop the rest of the execution of the include file but allow the script that included it to finish running. I have tried break, exit and die with no luck. Even tried break 1; and break 2; to break out of levels but that didn't seem to work either. Is there a solution or should I continue to do what I have done. Thanks in advance, Jonathan Pitcher -- 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] Break, Exit, Die, Kill, Maime and Stab
Technically you are not outside of a function. you need to use one of the include or require functions to include the file right? Jim Lucas - Original Message - From: Jonathan Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:30 PM Subject: Re: [PHP] Break, Exit, Die, Kill, Maime and Stab return will work outside of functions ?? That I didn't know. Thanks, Jonathan On Wednesday, July 2, 2003, at 04:28 PM, Jim Lucas wrote: return; will do the trick Jim Lucas - Original Message - From: Jonathan Pitcher [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, July 02, 2003 2:09 PM Subject: [PHP] Break, Exit, Die, Kill, Maime and Stab I have some scripting that includes files. The included files are executed and everything works great. The included page needs to check multiple information. Currently if I want the scripts to end correctly I have to: if () { } else { if () { } else if () { } } You get the picture. Code gets hard to read with so many If's and Elses. I would love to: if() { //Blah break; } and have that break only stop the rest of the execution of the include file but allow the script that included it to finish running. I have tried break, exit and die with no luck. Even tried break 1; and break 2; to break out of levels but that didn't seem to work either. Is there a solution or should I continue to do what I have done. Thanks in advance, Jonathan Pitcher -- 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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php