Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/29/2013 1:38 AM, Jim Giner wrote: session_start(); session_name("STORE"); set_time_limit(2400); ini_set('display_errors', 'on'); ini_set('display_startup_errors', 'on'); error_reporting(-2); ini_set('error_reporting', 'E_ALL | E_STRICT'); ini_set('html_

Re: [PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/29/2013 1:29 AM, Ethan Rosenberg wrote: On 09/28/2013 11:59 PM, Jim Giner wrote: Ethan,Ethan,Ethan - what is all this "stuff" you have at the top??? Do you know how any of this is supposed to be written? You can not put Constants in quotes - they become just plain strings then, not Cons

Re: [PHP] Re: Switch Statement

2013-09-28 Thread Ethan Rosenberg
On 09/28/2013 11:59 PM, Jim Giner wrote: Ethan,Ethan,Ethan - what is all this "stuff" you have at the top??? Do you know how any of this is supposed to be written? You can not put Constants in quotes - they become just plain strings then, not Constants with the predefined values you (and the

[PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
Ethan,Ethan,Ethan - what is all this "stuff" you have at the top??? Do you know how any of this is supposed to be written? You can not put Constants in quotes - they become just plain strings then, not Constants with the predefined values you (and the functions) are expecting. For example

[PHP] Re: Switch Statement

2013-09-28 Thread Jim Giner
On 9/28/2013 10:33 PM, Ethan Rosenberg wrote: Dear List - I have a working program. I made one change in a switch statement, and it does not work. I'm probably missing something fundamental. Here are some code SNIPPETS... [please note that all my debug statements are at the left margin] Set

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-19 Thread Andrew Ballard
On Sat, Nov 17, 2012 at 4:13 PM, Sebastian Krebs wrote: > 2012/11/17 Andrew Ballard > >> On Nov 16, 2012 10:24 PM, "tamouse mailing lists" >> wrote: >> > >> > On Fri, Nov 16, 2012 at 12:41 PM, Sebastian Krebs >> wrote: >> > > Beside this it can be rewritten as >> > > >> > > switch ((int) (($cou

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-19 Thread Sebastian Krebs
2012/11/19 Tim Streater > On 18 Nov 2012 at 14:44, Jim Giner wrote: > > > 2. Using Switch {ALWAYS FIRST CASE!!!} > > > > //$boxes = 1; > > //switch ($count) { > > //case ($count > 14): > > //$boxes = 3; > > //

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-19 Thread Stuart Dallas
On 19 Nov 2012, at 19:35, Tim Streater wrote: > On 18 Nov 2012 at 14:44, Jim Giner wrote: > >> 2. Using Switch {ALWAYS FIRST CASE!!!} >> >> //$boxes = 1; >> //switch ($count) { >> //case ($count > 14): >> //$boxes = 3; >>

[PHP] Re: Switch - Case Statement Questions

2012-11-19 Thread Tim Streater
On 18 Nov 2012 at 14:44, Jim Giner wrote: > 2. Using Switch {ALWAYS FIRST CASE!!!} > > //$boxes = 1; > //switch ($count) { > //case ($count > 14): > //$boxes = 3; > //break; > //case ($count >

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-19 Thread Jim Giner
On 11/16/2012 8:33 PM, Iñigo Medina wrote: On Fri, 16 Nov 2012, Jim Giner wrote: On 11/16/2012 12:38 PM, Tim Streater wrote: On 16 Nov 2012 at 12:10, Omar Muhsin wrote: Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PH

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread tamouse mailing lists
On Sat, Nov 17, 2012 at 2:59 PM, Sebastian Krebs wrote: > (Beside: Was "the principle of least surprise" not a ruby-thing? ;)) No, but the Ruby (and Rails) world takes concepts like this and really runs with them. Principle of Least Astonishment has been around for quite some time, with examples

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread tamouse mailing lists
On Sat, Nov 17, 2012 at 3:13 PM, Sebastian Krebs wrote: > 2012/11/17 Andrew Ballard > >> On Nov 16, 2012 10:24 PM, "tamouse mailing lists" >> wrote: >> > Just a tad obscure for someone coming along >> > later >> >> Without knowing the intent of the code, it could be a headache to maintain. >> >

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread Sebastian Krebs
2012/11/17 Andrew Ballard > On Nov 16, 2012 10:24 PM, "tamouse mailing lists" > wrote: > > > > On Fri, Nov 16, 2012 at 12:41 PM, Sebastian Krebs > wrote: > > > Beside this it can be rewritten as > > > > > > switch ((int) (($count-1) / 7) { > > > case 0: // 1-7 > > > case 1: // 8 - 14 > > >

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread Sebastian Krebs
2012/11/17 Tim Streater > On 17 Nov 2012 at 01:33, Iñigo Medina wrote: > > > On Fri, 16 Nov 2012, Jim Giner wrote: > > >> Maybe I'm way out of touch, but when I look at php.net for the syntax > of the > >> switch statement I see: > >> switch($var){ > >> case (value): > >> (do s

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread Andrew Ballard
On Nov 16, 2012 10:24 PM, "tamouse mailing lists" wrote: > > On Fri, Nov 16, 2012 at 12:41 PM, Sebastian Krebs wrote: > > Beside this it can be rewritten as > > > > switch ((int) (($count-1) / 7) { > > case 0: // 1-7 > > case 1: // 8 - 14 > > default: // above 15 > > } > > Nice code refacto

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread Stuart Dallas
On 17 Nov 2012, at 10:53, Tim Streater wrote: > On 17 Nov 2012 at 01:33, Iñigo Medina wrote: > >> On Fri, 16 Nov 2012, Jim Giner wrote: > >>> Maybe I'm way out of touch, but when I look at php.net for the syntax of the >>> switch statement I see: >>> switch($var){ >>> case (value): >>>

[PHP] Re: Switch - Case Statement Questions

2012-11-17 Thread Tim Streater
On 17 Nov 2012 at 01:33, Iñigo Medina wrote: > On Fri, 16 Nov 2012, Jim Giner wrote: >> Maybe I'm way out of touch, but when I look at php.net for the syntax of the >> switch statement I see: >> switch($var){ >> case (value): >> (do something) >> case (other value): >>

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-16 Thread tamouse mailing lists
On Fri, Nov 16, 2012 at 12:41 PM, Sebastian Krebs wrote: > Beside this it can be rewritten as > > switch ((int) (($count-1) / 7) { > case 0: // 1-7 > case 1: // 8 - 14 > default: // above 15 > } Nice code refactoring :) Just a tad obscure for someone coming along later, perhaps. -- PHP Ge

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-16 Thread Iñigo Medina
On Fri, 16 Nov 2012, Jim Giner wrote: On 11/16/2012 12:38 PM, Tim Streater wrote: On 16 Nov 2012 at 12:10, Omar Muhsin wrote: Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PHP is not validating the expressions instea

[PHP] Re: Switch - Case Statement Questions

2012-11-16 Thread Jim Giner
On 11/16/2012 12:38 PM, Tim Streater wrote: On 16 Nov 2012 at 12:10, Omar Muhsin wrote: Hello, I was just wondering after writting the code in version 2 here below, it turns out in testing that it actually PHP is not validating the expressions instead always I get the first case. 1.Using nes

Re: [PHP] Re: Switch - Case Statement Questions

2012-11-16 Thread Sebastian Krebs
2012/11/16 Tim Streater > On 16 Nov 2012 at 12:10, Omar Muhsin wrote: > > > Hello, > > > > I was just wondering after writting the code in version 2 here below, it > turns > > out in testing that it actually PHP is not validating the expressions > instead > > always I get the first case. > > > >

[PHP] Re: Switch - Case Statement Questions

2012-11-16 Thread Tim Streater
On 16 Nov 2012 at 12:10, Omar Muhsin wrote: > Hello, > > I was just wondering after writting the code in version 2 here below, it turns > out in testing that it actually PHP is not validating the expressions instead > always I get the first case. > > 1.Using nested if statement {THE INTENDED BEH

Re: [PHP] Re: Switch statement Question

2009-02-02 Thread Frank Stanovcak
"tedd" wrote in message news:p06240801c5aa0ed7d...@[192.168.1.101]... > At 4:16 PM +0100 1/30/09, Jochem Maas wrote: >>tedd schreef: >>> At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: >" yes...that is legal. as long as the statment resolves to a boolean it will

Re: [PHP] Re: Switch statement Question

2009-01-31 Thread tedd
At 4:16 PM +0100 1/30/09, Jochem Maas wrote: tedd schreef: At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: >" yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. There you go again. What's technically corr

Re: [PHP] Re: Switch statement Question

2009-01-30 Thread Jochem Maas
tedd schreef: > At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: >> >" >> >> yes...that is legal. as long as the statment resolves to a boolean it >> will >> work. It's not technically correct, but it does work. > > There you go again. What's technically correct? hiya tedd, you mean to ask "n

[PHP] Re: Switch statement Question

2009-01-30 Thread tedd
At 4:43 PM -0500 1/29/09, Frank Stanovcak wrote: >" yes...that is legal. as long as the statment resolves to a boolean it will work. It's not technically correct, but it does work. There you go again. What's technically correct? Cheers, tedd -- --- http://sperling.com http://ancient

[PHP] Re: Switch statement Question

2009-01-29 Thread Frank Stanovcak
>"Alice Wei" wrote in message >news:snt101-w587cd616331fc59b84834af0...@phx.gbl... > >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 . "AN

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

2008-08-31 Thread Lupus Michaelis
Diogo Neves a écrit : Hi, Well, I see a good reason anyway... U can have a lot of entry points and only one to exit... Like: I misunderstood the question :-/ I read Govinda had a strange behavior that ignore the break :-D -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP Ge

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

2008-08-31 Thread Diogo Neves
Hi, Well, I see a good reason anyway... U can have a lot of entry points and only one to exit... Like: switch ($i) { case 0: echo "\$i < 1"; case 1: echo "\$i < 2"; case 2: echo "\$i < 3"; default: echo "\$i > 2"; } Or switch ($i) { case 0: case 1: case 2: echo "\$i < 3"; brea

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

2008-08-31 Thread Lupus Michaelis
Govinda a écrit : Or is there a better reason? What is exactly in $i ? A scalar integer, a string containing an integer ? A boolean ? What version of PHP ? -- Mickaël Wolff aka Lupus Michaelis http://lupusmic.org -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: htt

[PHP] Re: Switch function problem

2003-06-11 Thread Bix
Cant be done mate, do it like this... switch ($val){ case "FFS": case "FHG": case "FRG": //stuff break; case "DPT": case "DL": case "DF": case "DI": case "DO": //stuff break; } The cases pass through each other till they hit a 'break' ;o) Bix "Stephen Goddard" <[EMAIL PROTECTED]>

[PHP] Re: Switch() ?????

2002-05-25 Thread Jens Lehmann
> I have a script that switches. > switch($pid) > { > case 1: > break; > > case 2: > break; > } > > Now I'm doing a check in case 1 and if everything goes well, i want to > switch directly to case 2 while the script is runny. > > How would i do that ??? > Don't write "break;" in