Re: [PHP] Switch Statement

2013-09-29 Thread mrfroasty
Hello, I suggest you put default in that switch statement and var_dump the $_POST.That should be enough for a programmer to pin point what goes wrong. P:S **You might want to consider versioning your codes to go back into its history to see what has changed. Muhsin On 09/29/2013 04:33 AM, Ethan

Re: [PHP] Switch Statement

2013-09-29 Thread Aziz Saleh
What is the output? On Sun, Sep 29, 2013 at 1:34 AM, Ethan Rosenberg < erosenb...@hygeiabiomedical.com> wrote: > On 09/28/2013 10:53 PM, Aziz Saleh wrote: > >> Ethan, can you do a var_dump instead of print_r. It might be that >> next_step >> has spaces in it causing the switch to not match. >> >

Re: [PHP] Switch Statement

2013-09-28 Thread Ethan Rosenberg
On 09/28/2013 10:53 PM, Aziz Saleh wrote: Ethan, can you do a var_dump instead of print_r. It might be that next_step has spaces in it causing the switch to not match. Aziz Aziz - Used var_dump no further information Ethan -- PHP General Mailing List (http://www.php.net/) To unsubscribe

Re: [PHP] Switch Statement

2013-09-28 Thread Aziz Saleh
Ethan, can you do a var_dump instead of print_r. It might be that next_step has spaces in it causing the switch to not match. Aziz On Sat, Sep 28, 2013 at 10:33 PM, Ethan Rosenberg < erosenb...@hygeiabiomedical.com> wrote: > Dear List - > > I have a working program. I made one change in a swit

Re: [PHP] Switch - Case Statement Questions

2012-11-21 Thread Tedd Sperling
On Nov 19, 2012, at 2:46 PM, Stuart Dallas wrote: > On 19 Nov 2012, at 19:35, Tim Streater wrote: > >> On 18 Nov 2012 at 14:44, Jim Giner wrote: >> Just so. Perhaps those who are not grasping the point could re-read their >> copy of "The Elements of Programming Style" by Kernighan and Plauge

RE: [PHP] switch case madness

2011-01-19 Thread Richard Sharp
LOL, so true -Original Message- From: Adam Richardson [mailto:simples...@gmail.com] Sent: Wednesday, January 19, 2011 12:28 PM To: PHP-General Subject: Re: [PHP] switch case madness On Wed, Jan 19, 2011 at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua K

Re: [PHP] switch case madness

2011-01-19 Thread Adam Richardson
On Wed, Jan 19, 2011 at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: > > On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: > >> [snip] > >> ... > >> [/snip] > >> Imagine when there'll be the day when you do not have to code at > >> all...just copy 'n paste sn

Re: [PHP] switch case madness

2011-01-19 Thread Joshua Kehn
On Jan 19, 2011, at 12:44 PM, Micky Hulse wrote: > On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: >> They have that. It's called Ruby on Rails. > > CodeIgniter and/or Django (Python) are fun. > > What about a middle of the road solution? > > Google for "php micro framework" and/or "python

Re: [PHP] switch case madness

2011-01-19 Thread Micky Hulse
On Wed, Jan 19, 2011 at 6:45 AM, Joshua Kehn wrote: > On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: >> [snip] >> ... >> [/snip] >> Imagine when there'll be the day when you do not have to code at >> all...just copy 'n paste snippets together in the order that you wish >> them to work in and Vo

Re: [PHP] switch case madness

2011-01-19 Thread David Hutto
. >> >>    I do see from where it is you're coming, though, Josh --- once >> you've gotten the fundamentals, a lot of times it's easier - sometimes >> even a better idea - to use an existing, mature solution.  What helps >> you to determine its value from a code standpoint?  Your existing >> experi

Re: [PHP] switch case madness

2011-01-19 Thread Joshua Kehn
> On Tue, Jan 18, 2011 at 23:39, Joshua Kehn wrote: >The use of existing packages is so increasingly prevalent that I > have the unfortunate displeasure of knowing many "developers" who do > nothing but this, yet who can't even answer simple questions about > general coding, and who cry and c

Re: [PHP] switch case madness

2011-01-19 Thread Daniel Brown
On Tue, Jan 18, 2011 at 23:39, Joshua Kehn wrote: > > Why not use one of the countless, not to mention secure and stable cookie > management systems available? If it's an exercise cool, I misunderstood. > > I'm not one to normally shun people rolling their own code, lord knows I've > done it mor

Re: [PHP] switch case madness

2011-01-19 Thread Marc Guay
> Imagine when there'll be the day when you do not have to code at > all...just copy 'n paste snippets together in the order that you wish > them to work in and Voila'! - instant web app. I have a Wordpress plugin that will do all of that for you. -- PHP General Mailing List (http://www.php.net/

Re: [PHP] switch case madness

2011-01-19 Thread Joshua Kehn
On Jan 19, 2011, at 9:43 AM, Jay Blanchard wrote: > [snip] > ... > [/snip] > > Imagine when there'll be the day when you do not have to code at > all...just copy 'n paste snippets together in the order that you wish > them to work in and Voila'! - instant web app. > > > Thtt

RE: [PHP] switch case madness

2011-01-19 Thread Jay Blanchard
[snip] ... [/snip] Imagine when there'll be the day when you do not have to code at all...just copy 'n paste snippets together in the order that you wish them to work in and Voila'! - instant web app. Th!! -- PHP General Mailing List (http://www.php.net/) To uns

Re: [PHP] switch case madness

2011-01-19 Thread Joshua Kehn
On Jan 18, 2011, at 11:53 PM, Donovan Brooke wrote: > The idea of using existing resources for efficiency is very valid indeed.. > especially with a job at hand. But, there are good reasons to > roll-your-own... education and knowing your own code are 2 that are important > to me right now. Bes

Re: [PHP] switch case madness

2011-01-18 Thread Paul M Foster
On Tue, Jan 18, 2011 at 10:53:19PM -0600, Donovan Brooke wrote: > >Why not use one of the countless, not to mention secure and stable cookie > management systems available? If it's an exercise cool, I misunderstood. > > > >I'm not one to normally shun people rolling their own code, lord knows > I'

Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke
Why not use one of the countless, not to mention secure and stable cookie management systems available? If it's an exercise cool, I misunderstood. I'm not one to normally shun people rolling their own code, lord knows I've done it more then once or twice, but there are some things I wouldn't to

Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 11:33 PM, Donovan Brooke wrote: >>> -- >>> D Brooke >> >> I just died a bit on the inside. >> >> Why would you build that from scratch? >> >> Regards, >> >> -Josh > > > Alright, I'll bite (since I affected you that much) ;-), > > do tell... > > Why not? Would you rather

Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke
-- D Brooke I just died a bit on the inside. Why would you build that from scratch? Regards, -Josh Alright, I'll bite (since I affected you that much) ;-), do tell... Why not? Would you rather I use PHP's session_start()? Donovan -- D Brooke -- PHP General Mailing List (http://www

Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 11:01 PM, Donovan Brooke wrote: > Thanks. > > I had initialized $t_mssg as an empty string further up the chain out of old > habit.. removed that, and now it works... just built my first > basic cookie-based PHP/MySQL log-in script from scratch! ;-) > > Fun stuff, > Donovan

Re: [PHP] switch case madness

2011-01-18 Thread Donovan Brooke
Thanks. I had initialized $t_mssg as an empty string further up the chain out of old habit.. removed that, and now it works... just built my first basic cookie-based PHP/MySQL log-in script from scratch! ;-) Fun stuff, Donovan -- D Brooke -- PHP General Mailing List (http://www.php.net/) T

Re: [PHP] switch case madness

2011-01-18 Thread Mujtaba Arshad
$t_mssg = 0 is different from $t_mssg = "0" (in all languages, as far as I know, maybe not in python, but I don't know python) On Tue, Jan 18, 2011 at 10:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fires when $t_mssg = "" apparently. >

Re: [PHP] switch case madness

2011-01-18 Thread Joshua Kehn
On Jan 18, 2011, at 10:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fires when $t_mssg = "" apparently. > Is this how it's suppose to work? I would think > it would only fire if it equaled "0". > > -- > print "-$t_mssg- "; >

Re: [PHP] switch case madness

2011-01-18 Thread Chen Dong
Hi, If it is a string "0", you should use: case "0". Because in PHP, 0 == false == null. You need to know the difference between == and ===. Regards, Dong Chen On Wed, Jan 19, 2011 at 2:30 PM, Donovan Brooke wrote: > Hello, > > I must not understand PHP's switch/case.. > The case '0' below fir

Re: [PHP] Switch Question...

2010-11-15 Thread Steve Staples
On Mon, 2010-11-15 at 22:43 +, Ashley Sheridan wrote: > On Mon, 2010-11-15 at 16:27 -0500, Steve Staples wrote: > > > Ok, dumb question, and i have tested, but I want to ensure that my tests > > were accurate, and behavior is correct. > > > > Ok, i have an integer, that based on what it is, d

Re: [PHP] Switch Question...

2010-11-15 Thread Ashley Sheridan
On Mon, 2010-11-15 at 16:27 -0500, Steve Staples wrote: > Ok, dumb question, and i have tested, but I want to ensure that my tests > were accurate, and behavior is correct. > > Ok, i have an integer, that based on what it is, does certain things... > > switch ((int)$intval) > { > } > > now, if

Re: [PHP] Switch statement Question

2009-01-30 Thread Thodoris
Hi, I have a code snippet here as in the following: //Switch statements between the four options switch($string) { case "": $string= "NOT book.author='All'"; break; default: $string= $string . "AND NOT book.author='All'"; break; } This code does work, but I am wondering if it is possib

Re: [PHP] Switch statement Question

2009-01-29 Thread Jochem Maas
Boyd, Todd M. schreef: >> -Original Message- >> From: Alice Wei [mailto:aj...@alumni.iu.edu] >> Sent: Thursday, January 29, 2009 3:02 PM >> To: php-general@lists.php.net >> Subject: [PHP] Switch statement Question >> >> >> Hi, >> >> I have a code snippet here as in the following: >> >> //

RE: [PHP] Switch statement Question

2009-01-29 Thread Boyd, Todd M.
> -Original Message- > From: Alice Wei [mailto:aj...@alumni.iu.edu] > Sent: Thursday, January 29, 2009 3:02 PM > To: php-general@lists.php.net > Subject: [PHP] Switch statement Question > > > Hi, > > I have a code snippet here as in the following: > > //Switch statements between the f

Re: [PHP] switch vs elseif

2009-01-14 Thread tedd
At 2:18 PM -0600 1/13/09, Micah Gersten wrote: Jochem Maas wrote: switch (true) { case ($x === $y): // something > break; This is a misuse of the switch statement. Switch is meant to compare values to a single variable as stated on the manual page: http://us

Re: [PHP] switch vs elseif

2009-01-13 Thread Kirk . Johnson
I regret that I don't recall who made the brilliant observation that programmers spend the majority of their time *reading* code (their own or others) as opposed to *writing* code. So, I make it a point to try to make my code easily scannable. I only and always use the switch construct when eva

Re: [PHP] switch vs elseif

2009-01-13 Thread Robert Cummings
On Tue, 2009-01-13 at 22:12 +0100, Jochem Maas wrote: > Robert Cummings schreef: > > On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: > >> Ashley Sheridan schreef: > >>> On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: > I've googled, and found some confusing answers. > I've

Re: [PHP] switch vs elseif

2009-01-13 Thread Shawn McKenzie
Micah Gersten wrote: > Jochem Maas wrote: >> switch (true) { >> case ($x === $y): >> // something >> break; >> >> case ($a != $b): >> // something >> break; >> >> case (myFunc()): >> // something >> break;

Re: [PHP] switch vs elseif

2009-01-13 Thread Jochem Maas
Nathan Rixham schreef: > Jochem Maas wrote: >> Micah Gersten schreef: >>> Jochem Maas wrote: switch (true) { > > should be switch(false) { > > :-) > it could be either depending on your needs, no? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net

Re: [PHP] switch vs elseif

2009-01-13 Thread Jochem Maas
Robert Cummings schreef: > On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: >> Ashley Sheridan schreef: >>> On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found inf

Re: [PHP] switch vs elseif

2009-01-13 Thread Nathan Rixham
Jochem Maas wrote: Micah Gersten schreef: Jochem Maas wrote: switch (true) { should be switch(false) { :-) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] switch vs elseif

2009-01-13 Thread Jochem Maas
Micah Gersten schreef: > Jochem Maas wrote: >> switch (true) { >> case ($x === $y): >> // something >> break; >> >> case ($a != $b): >> // something >> break; >> >> case (myFunc()): >> // something >> break

Re: [PHP] switch vs elseif

2009-01-13 Thread ceo
I think if they didn't want us to use expressions in the case, then they wouldn't have put support into the language for that. I daresay you are reading more into the text than was intended... I certainly have found switch(true) with complex expressions for case quite handy and very clear

Re: [PHP] switch vs elseif

2009-01-13 Thread Micah Gersten
Jochem Maas wrote: > switch (true) { > case ($x === $y): > // something > break; > > case ($a != $b): > // something > break; > > case (myFunc()): > // something > break; > > case ($my->getCh

Re: [PHP] switch vs elseif

2009-01-13 Thread Robert Cummings
On Tue, 2009-01-13 at 15:50 +0100, Jochem Maas wrote: > Ashley Sheridan schreef: > > On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: > >> I've googled, and found some confusing answers. > >> I've tried searching the history of the news group, and only found info on > >> switch or elseif

Re: [PHP] switch vs elseif

2009-01-13 Thread Eric Butera
On Tue, Jan 13, 2009 at 9:50 AM, Jochem Maas wrote: > switch (true) { >case ($x === $y): >// something >break; > >case ($a != $b): >// something >break; > >case (myFunc()): >// something >

Re: [PHP] switch vs elseif

2009-01-13 Thread Jochem Maas
Ashley Sheridan schreef: > On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: >> I've googled, and found some confusing answers. >> I've tried searching the history of the news group, and only found info on >> switch or elseif seperately. :( >> >> Strictly from a performance stand point, n

Re: [PHP] switch vs elseif

2009-01-12 Thread tedd
At 5:12 PM -0500 1/12/09, Robert Cummings wrote: On Mon, 2009-01-12 at 17:09 -0500, tedd wrote: At 4:57 PM -0500 1/12/09, Robert Cummings wrote: >No, that's DIFFERENT from what I wrote. Go back and re-read. > >:) I did and reread again -- it looks different. I'm simply talking about the s

Re: [PHP] switch vs elseif

2009-01-12 Thread Robert Cummings
On Mon, 2009-01-12 at 17:09 -0500, tedd wrote: > At 4:57 PM -0500 1/12/09, Robert Cummings wrote: > >No, that's DIFFERENT from what I wrote. Go back and re-read. > > > >:) > > I did and reread again -- it looks different. I'm simply talking > about the spacing. > > No matter though, it's the sam

Re: [PHP] switch vs elseif

2009-01-12 Thread tedd
At 4:57 PM -0500 1/12/09, Robert Cummings wrote: No, that's DIFFERENT from what I wrote. Go back and re-read. :) I did and reread again -- it looks different. I'm simply talking about the spacing. No matter though, it's the same code. Cheers, tedd -- --- http://sperling.com http://

Re: [PHP] switch vs elseif

2009-01-12 Thread Ashley Sheridan
On Mon, 2009-01-12 at 16:49 -0500, tedd wrote: > At 3:32 PM -0500 1/12/09, Robert Cummings wrote: > >One has to wonder about the readability of the case version though since > >one may not notice immediately the missing break statement. > > > >Cheers, > >Rob. > > Yes, but that's because of the way

Re: [PHP] switch vs elseif

2009-01-12 Thread Chris
tedd wrote: At 3:32 PM -0500 1/12/09, Robert Cummings wrote: One has to wonder about the readability of the case version though since one may not notice immediately the missing break statement. Cheers, Rob. Yes, but that's because of the way you wrote it -- consider this: I'm sure that was

Re: [PHP] switch vs elseif

2009-01-12 Thread Robert Cummings
On Mon, 2009-01-12 at 16:49 -0500, tedd wrote: > At 3:32 PM -0500 1/12/09, Robert Cummings wrote: > >One has to wonder about the readability of the case version though since > >one may not notice immediately the missing break statement. > > > >Cheers, > >Rob. > > Yes, but that's because of the way

Re: [PHP] switch vs elseif

2009-01-12 Thread tedd
At 3:32 PM -0500 1/12/09, Robert Cummings wrote: One has to wonder about the readability of the case version though since one may not notice immediately the missing break statement. Cheers, Rob. Yes, but that's because of the way you wrote it -- consider this: If you group the case's togeth

Re: [PHP] switch vs elseif

2009-01-12 Thread tedd
At 3:15 PM -0500 1/12/09, Frank Stanovcak wrote: I've googled, and found some confusing answers. I've tried searching the history of the news group, and only found info on switch or elseif seperately. :( Strictly from a performance stand point, not preference or anything else, is there a benefi

Re: [PHP] switch vs elseif -- switchtable

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 4:00 PM, Daevid Vincent wrote: > On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote: > >> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak >> wrote: >> > I've googled, and found some confusing answers. >> > I've tried searching the history of the news group, and only fou

Re: [PHP] switch vs elseif -- switchtable

2009-01-12 Thread Daevid Vincent
On Mon, 2009-01-12 at 15:31 -0500, Eric Butera wrote: > On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak > wrote: > > I've googled, and found some confusing answers. > > I've tried searching the history of the news group, and only found info on > > switch or elseif seperately. :( > > > > Strictl

Re: [PHP] switch vs elseif

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:58 PM, Frank Stanovcak wrote: > > ""Eric Butera"" wrote in message > news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com... >> On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak >> wrote: >>> I've googled, and found some confusing answers. >>> I've tried sear

Re: [PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak
""Eric Butera"" wrote in message news:6a8639eb0901121231r253eed48xe1974d8ef44ab...@mail.gmail.com... > On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak > wrote: >> I've googled, and found some confusing answers. >> I've tried searching the history of the news group, and only found info >> on >

Re: [PHP] switch vs elseif

2009-01-12 Thread Frank Stanovcak
"Ashley Sheridan" wrote in message news:1231793310.3558.55.ca...@localhost.localdomain... > On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: >> I've googled, and found some confusing answers. >> I've tried searching the history of the news group, and only found info >> on >> switch or el

Re: [PHP] switch vs elseif

2009-01-12 Thread Ashley Sheridan
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: > I've googled, and found some confusing answers. > I've tried searching the history of the news group, and only found info on > switch or elseif seperately. :( > > Strictly from a performance stand point, not preference or anything else,

Re: [PHP] switch vs elseif

2009-01-12 Thread Robert Cummings
On Mon, 2009-01-12 at 15:15 -0500, Frank Stanovcak wrote: > I've googled, and found some confusing answers. > I've tried searching the history of the news group, and only found info on > switch or elseif seperately. :( > > Strictly from a performance stand point, not preference or anything else,

Re: [PHP] switch vs elseif

2009-01-12 Thread Eric Butera
On Mon, Jan 12, 2009 at 3:15 PM, Frank Stanovcak wrote: > I've googled, and found some confusing answers. > I've tried searching the history of the news group, and only found info on > switch or elseif seperately. :( > > Strictly from a performance stand point, not preference or anything else, is

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-13 Thread Eric Gorr
On Sep 13, 2008, at 12:12 PM, Robert Cummings wrote: On Sat, 2008-09-13 at 10:09 -0400, Eric Gorr wrote: On Sep 12, 2008, at 5:13 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 16:51 -0400, Eric Gorr wrote: On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 16:11

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-13 Thread Robert Cummings
On Sat, 2008-09-13 at 10:09 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 5:13 PM, Robert Cummings wrote: > > > On Fri, 2008-09-12 at 16:51 -0400, Eric Gorr wrote: > >> On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote: > >> > >>> On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote: > On Sep

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-13 Thread Eric Gorr
On Sep 12, 2008, at 5:13 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 16:51 -0400, Eric Gorr wrote: On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote: On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote: I don't see how that in any wa

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Ashley Sheridan
Well, I've often found the need to treat several conditions with the same set of statements within a switch: switch($some_number) { case 1: case 2: { // do some shizzle break; } case 3: { // foshizzle that nizzle break; } default:

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 16:51 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote: > > > On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote: > >> On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote: > >>> > >>> I don't see how that in any way makes an argument for or against.

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Eric Gorr
On Sep 12, 2008, at 4:27 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote: On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote: I don't see how that in any way makes an argument for or against. Once still must spend client's money wasting time on code that has

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 16:11 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote: > > > > I don't see how that in any way makes an argument for or against. Once > > still must spend client's money wasting time on code that has > > questionable merit. Yes, some debugging code

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Eric Gorr
On Sep 12, 2008, at 3:44 PM, Robert Cummings wrote: I don't see how that in any way makes an argument for or against. Once still must spend client's money wasting time on code that has questionable merit. Yes, some debugging code is a great boon in any application, but littered everywhere to fu

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 15:15 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 2:51 PM, Robert Cummings wrote: > > > On Fri, 2008-09-12 at 14:33 -0400, Eric Gorr wrote: > >> On Sep 12, 2008, at 2:14 PM, Robert Cummings wrote: > >> > >>> On Fri, 2008-09-12 at 11:47 -0400, Eric Gorr wrote: > On Sep

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Eric Gorr
On Sep 12, 2008, at 2:51 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 14:33 -0400, Eric Gorr wrote: On Sep 12, 2008, at 2:14 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 11:47 -0400, Eric Gorr wrote: On Sep 12, 2008, at 11:39 AM, Andrew Ballard wrote: On Fri, Sep 12, 2008 at 9:52 A

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 14:33 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 2:14 PM, Robert Cummings wrote: > > > On Fri, 2008-09-12 at 11:47 -0400, Eric Gorr wrote: > >> On Sep 12, 2008, at 11:39 AM, Andrew Ballard wrote: > >> > >>> On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <[EMAIL PROTECTED]> >

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Eric Gorr
On Sep 12, 2008, at 2:14 PM, Robert Cummings wrote: On Fri, 2008-09-12 at 11:47 -0400, Eric Gorr wrote: On Sep 12, 2008, at 11:39 AM, Andrew Ballard wrote: On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: Luke schreef: I wonder if this is a shared trait between C an

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread tedd
At 10:58 AM +0100 9/12/08, Luke wrote: I wonder if this is a shared trait between C and PHP (since I understand PHP is written in C) that the break; and the default: are placed for good practice in all switch statements since they prevent memory leaks? First, the evolution of computer languag

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 11:47 -0400, Eric Gorr wrote: > On Sep 12, 2008, at 11:39 AM, Andrew Ballard wrote: > > > On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <[EMAIL PROTECTED]> > > wrote: > >> Luke schreef: > >>> > >>> I wonder if this is a shared trait between C and PHP (since I > >>> underst

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Robert Cummings
On Fri, 2008-09-12 at 10:58 +0100, Luke wrote: > I wonder if this is a shared trait between C and PHP (since I understand PHP > is written in C) that the break; and the default: are placed for good > practice in all switch statements since they prevent memory leaks? Prevent memory leaks? WHAT? Ev

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Eric Gorr
On Sep 12, 2008, at 11:39 AM, Andrew Ballard wrote: On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: Luke schreef: I wonder if this is a shared trait between C and PHP (since I understand PHP is written in C) that the break; and the default: are placed for good

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Andrew Ballard
On Fri, Sep 12, 2008 at 9:52 AM, Jochem Maas <[EMAIL PROTECTED]> wrote: > Luke schreef: >> >> I wonder if this is a shared trait between C and PHP (since I understand >> PHP >> is written in C) that the break; and the default: are placed for good >> practice in all switch statements since they prev

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Jochem Maas
Luke schreef: I wonder if this is a shared trait between C and PHP (since I understand PHP is written in C) that the break; and the default: are placed for good practice in all switch statements since they prevent memory leaks? default is not required, never heard it was good practice to always

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-12 Thread Luke
I wonder if this is a shared trait between C and PHP (since I understand PHP is written in C) that the break; and the default: are placed for good practice in all switch statements since they prevent memory leaks? 2008/9/10 Jochem Maas <[EMAIL PROTECTED]> > tedd schreef: > > At 6:46 PM -0600 8/31

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-09 Thread Jochem Maas
tedd schreef: At 6:46 PM -0600 8/31/08, Govinda wrote: Not that it is an issue, but just to understand the logic- Why do we have to use 'break' statements in each case? switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2

Re: [PHP] switch case - to require the break statements seems strange to me

2008-09-09 Thread tedd
At 6:46 PM -0600 8/31/08, Govinda wrote: Not that it is an issue, but just to understand the logic- Why do we have to use 'break' statements in each case? switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; }

Re: [PHP] switch case - to require the break statements seems strange to me

2008-08-31 Thread Jochem Maas
Govinda schreef: Not that it is an issue, but just to understand the logic- Why do we have to use 'break' statements in each case? switch ($i) { case 0: echo "i equals 0"; break; case 1: echo "i equals 1"; break; case 2: echo "i equals 2"; break; } all 3 cases fire, even

Re: [PHP] switch()

2006-08-29 Thread afan
> What you're saying in that case is either col_1 evaluates to value1 or > col_2 evaluates to value2. Correct. To be more specific (it was better I did from begining :)) After an "order" is submitted, the code is checking are there any coments about tax charges (col_1) and/or billing charges (col_2

Re: [PHP] switch()

2006-08-29 Thread Ray Hauge
On Tuesday 29 August 2006 14:12, [EMAIL PROTECTED] wrote: > No. They are two if statements because they are indepedent. > > > On Tuesday 29 August 2006 13:44, Ray Hauge wrote: > >> Using a switch like this is more equivalent of > >> > >> if(something){ > >> // true > >> } else { > >> // false > >>

Re: [PHP] switch()

2006-08-29 Thread afan
No. They are two if statements because they are indepedent. > On Tuesday 29 August 2006 13:44, Ray Hauge wrote: >> Using a switch like this is more equivalent of >> >> if(something){ >> // true >> } else { >> // false >> } > > Actually, it's more like an if/elseif/else (if you use default:) or >

Re: [PHP] switch()

2006-08-29 Thread afan
Means, my first solution was the only solution. Thanks. -afan > Using a switch like this is more equivalent of > > if(something){ > // true > } else { > // false > } > > You're doing : > > if(something1){ > // true 1 > } > > if(something2){ > // true2 > } > > hope that helps. > > -- > Ray Haug

Re: [PHP] switch()

2006-08-29 Thread Ray Hauge
On Tuesday 29 August 2006 13:44, Ray Hauge wrote: > Using a switch like this is more equivalent of > > if(something){ > // true > } else { > // false > } Actually, it's more like an if/elseif/else (if you use default:) or if/elseif (without default:) -- Ray Hauge Programmer/Systems Administrato

Re: [PHP] switch()

2006-08-29 Thread Ray Hauge
On Tuesday 29 August 2006 13:31, [EMAIL PROTECTED] wrote: > I have something like this: > > $query = mysql_query(" > SELECT col_1, col_2 > FROM table > "); > $result = mysql_fetch_array($query); > if ($result['col_1'] == 'value_1') > { > // do something > }

Re: [PHP] switch it button

2006-08-23 Thread Arpad Ray
Ford, Mike wrote: How about something like: switch Beware that PHP_SELF is injectable like several other $_SERVER variables, so you must at least encode it to prevent XSS attacks. Eg. http://example.com/foo.php/";>

Re: [PHP] switch it button

2006-08-23 Thread tedd
At 12:44 PM +0100 8/23/06, Ross wrote: At the moment I have this, but I want to change it to one switch button I think I know what you mean -- a single switch button. Please review this kiddie-script: http://xn--ovg.com/a/toggle.php hth's tedd -- --- http://sperling.com http://ancients

RE: [PHP] switch it button

2006-08-23 Thread Ford, Mike
On 23 August 2006 12:45, Ross wrote: > At the moment I have this, but I want to change it to one > switch button > > switch it. > I > > have tried but keep getting wrapped up in nested if-else statements. > Does anyone know how to make an efficient one button on-off switch. > > > > $sessio

RE: [PHP] switch it button

2006-08-23 Thread Jay Blanchard
[snip] At the moment I have this, but I want to change it to one switch button switch it. I have tried but keep getting wrapped up in nested if-else statements. Does anyone know how to make an efficient one button on-off switch. [/snip] Have you considered a switch statement? http://www.php.n

Re: [PHP] switch question

2005-04-07 Thread Ryan A
Hey, > Can I jump to html and back to php in the middle on switch yes, you can. Question: I know this might sound silly but why didnt you try it before writing to the list? you would have gotten your answer much quicker. Cheers, Ryan -- No virus found in this outgoing message. Checked by AV

Re: [PHP] switch question

2005-04-07 Thread John Nichel
William Stokes wrote: Hello, Can I jump to html and back to php in the middle on switch Test the question. -- John C. Nichel ÜberGeek KegWorks.com 716.856.9675 [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

RE: [PHP] switch question

2005-04-07 Thread Jay Blanchard
[snip] Can I jump to html and back to php in the middle on switch [/snip] Yes -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] Switch Form

2005-02-01 Thread Richard Lynch
Lancer Emotion 16 wrote: > > > > > > > Now, in page.php is possible to do a switch of form name? Something like > this : > > Switch ($_POST['form'] { > 'form1' : ... > 'form2' : ... > } > > If this is possible,i dont know how to call it, can you help me please? The NAME attribut

RE: [PHP] Switch Form

2005-02-01 Thread Jay Blanchard
[snip] Hi list,I have 2 forms : Now, in page.php is possible to do a switch of form name? Something like this : Switch ($_POST['form'] { 'form1' : ... 'form2' : ... } If this is possible,i dont know how to call it, can you help me please? [/snip] Do this... switch

Re: [PHP] switch structure...

2003-06-19 Thread Chris Boget
> Oh... you know, I've gotta stop leaving my brain at home. Thanks Chris, > R'twick.. It sure is a relief to know that this list is here when I'm > having bad PHP days.. which lately, is everyday... This solved my problem > perfectly. np. We've all had our brain fart days. Or weeks. :p Ch

RE: [PHP] switch structure...

2003-06-19 Thread Dan Joseph
Hi, > Just do a conditional break. > case 0: > blah blah blah. > if (my condition == false) > break; > case 1: > blah blah .. Oh... you know, I've gotta stop leaving my brain at home. Thanks Chris, R'twick.. It sure is a relief to know that th

Re: [PHP] switch structure...

2003-06-19 Thread R'twick Niceorgaw
On 19 Jun 2003 at 13:52, Dan Joseph wrote: > Hi All, > > Looking for some guidance on something I want to be able to do with switch, > and I don't think it exists, but I'd like to consult the list as a last > resort. > > I have a switch setup similar to: > > switch ($step) { >

Re: [PHP] switch structure...

2003-06-19 Thread Chris Boget
> I have a switch setup similar to: > Under case 0, I'd like to do a few things, and then if a certain condition > is met, move into case 1. Is this possible? Am I off the wall here? Is > there a better way of doing this madness I've come up with? Just do a conditional break. Chris -- PHP G

  1   2   >