[PHP] professional code quick tip

2005-09-20 Thread adriano ghezzi
hy guys this night I'm quite tired I need a little tip ok var n could be from 0 to 12 var f must be set f=1 if0n=4 f=2 if 5n=7 f=3 if 8n=12 f=4 if n12 due to my fatigue I coded four if-if else statement, in other languages it is possible use conditional epression in switch case like

Re: [PHP] professional code quick tip

2005-09-20 Thread Robert Cummings
On Tue, 2005-09-20 at 19:20, adriano ghezzi wrote: hy guys this night I'm quite tired I need a little tip ok var n could be from 0 to 12 var f must be set f=1 if0n=4 f=2 if 5n=7 f=3 if 8n=12 f=4 if n12 due to my fatigue I coded four if-if else statement, in other

Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg
in other languages it is possible use conditional epression in switch case like switch $n case (0n=4): but no in php You could use the following statement: ?php switch (true) { case (0 $n = 4): $f = 1; break; case (5 $n = 7): $f = 2; break; case (8 $n = 12): $f = 3; break;

Re: [PHP] professional code quick tip

2005-09-20 Thread Robert Cummings
On Tue, 2005-09-20 at 19:47, Thorsten Suckow-Homberg wrote: You could use the following statement: ?php switch (true) { case (0 $n = 4): $f = 1; break; case (5 $n = 7): $f = 2; break; case (8 $n = 12): $f = 3; break; default: $f = 4; break; } I'm certain that is illegal.

Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg
I'm certain that is illegal. Wanna bet? :) -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] professional code quick tip

2005-09-20 Thread Jasper Bryant-Greene
Robert Cummings wrote: On Tue, 2005-09-20 at 19:47, Thorsten Suckow-Homberg wrote: You could use the following statement: ?php switch (true) { case (0 $n = 4): $f = 1; break; case (5 $n = 7): $f = 2; break; case (8 $n = 12): $f = 3; break; default: $f = 4; break; } I'm certain that is

Re: [PHP] professional code quick tip

2005-09-20 Thread Robert Cummings
On Tue, 2005-09-20 at 19:55, Thorsten Suckow-Homberg wrote: I'm certain that is illegal. Wanna bet? :) $100... cuz I'm sure you didn't mean to compound those conditionals such that PHP doesn't understand them ;) snaffu:~ php foo.php Content-type: text/html X-Powered-By: PHP/4.4.0 br /

Re: [PHP] professional code quick tip

2005-09-20 Thread Jasper Bryant-Greene
Robert Cummings wrote: On Tue, 2005-09-20 at 19:55, Thorsten Suckow-Homberg wrote: I'm certain that is illegal. Wanna bet? :) $100... cuz I'm sure you didn't mean to compound those conditionals such that PHP doesn't understand them ;) Fair enough, but I believe it was the use of the

Re: [PHP] professional code quick tip

2005-09-20 Thread Thorsten Suckow-Homberg
$100... cuz I'm sure you didn't mean to compound those conditionals such that PHP doesn't understand them ;) nargh... yes you're right... send me your account information along with your paypal login. I'll send you the money asap ;) -- PHP General Mailing List (http://www.php.net/) To

Re: [PHP] professional code quick tip ---last---

2005-09-20 Thread adriano ghezzi
thx to all -- final release good nigh! $f=0; if ( $ar[0]0 and $ar[0]=12) $f=1; elseif ( $ar[0]12 and $ar[0]=14) $f=2; elseif ( $ar[0]14 and $ar[0]=18) $f=3;