Re: [PHP] if question

2005-04-06 Thread Richard Lynch
On Wed, April 6, 2005 1:47 am, William Stokes said: > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? To be pedantic, in addition to using % (modulus) operator, you'd want to check: $x > 0 in order to rule out 0, -3, -6, -9

Re: [PHP] if question

2005-04-06 Thread Lars B. Jensen
> I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes if ($variable%3 == 0) #do something -- Lars B. Jensen, Internet Architect CareerCross Japan Japan's premier online career resource for english speaking professionals http://www.careercross.com

RE: [PHP] if question

2005-04-06 Thread Kim Madsen
> -Original Message- > From: William Stokes [mailto:[EMAIL PROTECTED] > Sent: Wednesday, April 06, 2005 10:48 AM > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? Have a look at modulus: http://dk.php.net/manual/e

Re: [PHP] if question

2005-04-06 Thread Burhan Khalid
William Stokes wrote: Hello, I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes on like this. How this can be done? if ($var % 3 == 0) { echo $var." is divisible by 3"; } -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.ph

Fwd: [PHP] if question

2005-04-06 Thread Ken
On Apr 6, 2005 10:47 AM, William Stokes <[EMAIL PROTECTED]> wrote: > > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes > on like this. > > How this can be done? > > Thanks > -Will > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscrib

Re: [PHP] if question

2005-04-06 Thread Andy Pieters
On Wednesday 06 April 2005 10:47, William Stokes wrote: > Hello, > > I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... > goes on like this. > > How this can be done? > > Thanks > -Will switch($yourvar) {case 3: somestuff; break; case 6: somestuff;

[PHP] if question

2005-04-06 Thread William Stokes
Hello, I need to test if a variable value is 3 or 6 or 9 or 12 or 15 or 18 ... goes on like this. How this can be done? Thanks -Will -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] if question

2002-12-17 Thread John Fishworld
DUH ! Thanks all ! Obviously a slight case of brain death there ! > Hi John, > > > Can anyone tell me why this doesn't seem to work ?? > > It probably is working, but it's obviously not doing what you want :-) > > > if (($stelle_who != '1') OR ($stelle_who != '2') OR > > ($stelle_who != '3')

Re: [PHP] if question

2002-12-17 Thread Justin French
Oooops -- forgot to mention -- you might want AND not OR or ||... and some other posts have hinted that OR does work... Justin on 18/12/02 12:30 AM, Justin French ([EMAIL PROTECTED]) wrote: > Not sure if 'OR' works... I use a double pipe/vertical bar ('||') for 'OR' > > $stelle_who = '4'; > i

Re: [PHP] if question

2002-12-17 Thread Justin French
Not sure if 'OR' works... I use a double pipe/vertical bar ('||') for 'OR' Jus to point out the really obvious... in the above example, the following would also work: Cheers, Justin on 18/12/02 12:04 AM, John Fishworld ([EMAIL PROTECTED]) wrote: > Help ! > > Can anyone tell me why this

RE: [PHP] if question

2002-12-17 Thread Jon Haworth
Hi John, > Can anyone tell me why this doesn't seem to work ?? It probably is working, but it's obviously not doing what you want :-) > if (($stelle_who != '1') OR ($stelle_who != '2') OR > ($stelle_who != '3') OR ($stelle_who != '5') ) { This will always evaluate to true: if $stelle_who

Re: [PHP] if question

2002-12-17 Thread Jason Wong
On Tuesday 17 December 2002 21:04, John Fishworld wrote: > Help ! > > Can anyone tell me why this doesn't seem to work ?? _HOW_ does it not work? > if (($stelle_who != '1') OR ($stelle_who != '2') OR ($stelle_who != '3') OR > ($stelle_who != '5') ) { > > and what can i use as an alternative synte

[PHP] if question

2002-12-17 Thread John Fishworld
Help ! Can anyone tell me why this doesn't seem to work ?? if (($stelle_who != '1') OR ($stelle_who != '2') OR ($stelle_who != '3') OR ($stelle_who != '5') ) { and what can i use as an alternative syntex ?? thanks in advance -- PHP General Mailing List (http://www.php.net/) To unsubscribe,