Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Barry wrote: > Jochem Maas schrieb: >> Barry wrote: >>> Jochem Maas schrieb: ... > > Well i don't want the grandma to be not as old as the table and older > than the house age and still baking a cookie. > > Only if all cases stated are true, i want to bake a cookie :) then reverse the logic of

Re: [PHP] Short writage of clauses

2006-06-12 Thread Barry
Jochem Maas schrieb: Barry wrote: Jochem Maas schrieb: > I find a switch statement sometimes handy for creating a 'truth table' like you describe (I sometimes find it easier to read and/or add 'if' clauses): switch (true) { case ($grandmaAge >= $tableAge): case ($grandmaAge < $houseAg

Re: [PHP] Short writage of clauses

2006-06-12 Thread Satyam
- Original Message - From: "Stut" <[EMAIL PROTECTED]> Jochem Maas wrote: Stut wrote: But it begs the question why you would want to do this? it's a handy way to white list data. e.g. if (in_array($_GET['yourarg'], $allowedValsForYourArg)) echo "nice arg dude"; (btw: no need t

Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Stut wrote: > Jochem Maas wrote: >> Stut wrote: >> >>> But it begs the question why you would want to do this? >>> >> >> it's a handy way to white list data. e.g. >> >> if (in_array($_GET['yourarg'], $allowedValsForYourArg)) echo "nice arg >> dude"; >> >> (btw: no need to beg ;-) >> > >

Re: [PHP] Short writage of clauses

2006-06-12 Thread Barry
Stut schrieb: Jochem Maas wrote: Stut wrote: But it begs the question why you would want to do this? it's a handy way to white list data. e.g. if (in_array($_GET['yourarg'], $allowedValsForYourArg)) echo "nice arg dude"; (btw: no need to beg ;-) I agree that the in_array funct

Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Barry wrote: > Jochem Maas schrieb: > > I find a switch statement sometimes handy for creating a 'truth table' >> like you describe (I sometimes find it easier to read and/or add 'if' >> clauses): >> >> switch (true) { >> case ($grandmaAge >= $tableAge): >> case ($grandmaAge < $houseAge):

Re: [PHP] Short writage of clauses

2006-06-12 Thread Stut
Jochem Maas wrote: Stut wrote: But it begs the question why you would want to do this? it's a handy way to white list data. e.g. if (in_array($_GET['yourarg'], $allowedValsForYourArg)) echo "nice arg dude"; (btw: no need to beg ;-) I agree that the in_array function is useful, b

RE: [PHP] Short writage of clauses

2006-06-12 Thread Peter Lauri
Subject: Re: [PHP] Short writage of clauses Jochem Maas schrieb: > I find a switch statement sometimes handy for creating a 'truth table' > like you describe (I sometimes find it easier to read and/or add 'if' clauses): > > switch (true) { > case ($gra

Re: [PHP] Short writage of clauses

2006-06-12 Thread Barry
Jochem Maas schrieb: > I find a switch statement sometimes handy for creating a 'truth table' like you describe (I sometimes find it easier to read and/or add 'if' clauses): switch (true) { case ($grandmaAge >= $tableAge): case ($grandmaAge < $houseAge): case ($grandmaAg

Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Stut wrote: > Barry wrote: >> Well i do know that you can write IF as ( ? : ) but what i am asking >> about is something like this: >> >> if (a = 1 OR a = 2) > > I think you mean == not =. > >> is it anyway possible to write it like: >> if (a = 1 OR 2) >> >> I know this is wrong because "2" will

Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Barry wrote: > Stut schrieb: >> Barry wrote: >>> Well i do know that you can write IF as ( ? : ) but what i am asking >>> about is something like this: >>> >>> if (a = 1 OR a = 2) >> >> I think you mean == not =. > Yeah. sorry ;) >> >>> is it anyway possible to write it like: >>> if (a = 1 OR 2) >>

Re: [PHP] Short writage of clauses

2006-06-12 Thread Barry
Stut schrieb: Barry wrote: Well i do know that you can write IF as ( ? : ) but what i am asking about is something like this: if (a = 1 OR a = 2) I think you mean == not =. Yeah. sorry ;) is it anyway possible to write it like: if (a = 1 OR 2) I know this is wrong because "2" will alway

Re: [PHP] Short writage of clauses

2006-06-12 Thread Stut
Barry wrote: Well i do know that you can write IF as ( ? : ) but what i am asking about is something like this: if (a = 1 OR a = 2) I think you mean == not =. is it anyway possible to write it like: if (a = 1 OR 2) I know this is wrong because "2" will always be true ... Any infos on that

Re: [PHP] Short writage of clauses

2006-06-12 Thread Dave Goodchild
On 12/06/06, Barry <[EMAIL PROTECTED]> wrote: Hi everyone! Well i do know that you can write IF as ( ? : ) but what i am asking about is something like this: if (a = 1 OR a = 2) is it anyway possible to write it like: if (a = 1 OR 2) I know this is wrong because "2" will always be true ...

Re: [PHP] Short writage of clauses

2006-06-12 Thread Jochem Maas
Barry wrote: > Hi everyone! > > Well i do know that you can write IF as ( ? : ) but what i am asking > about is something like this: > > if (a = 1 OR a = 2) > > is it anyway possible to write it like: > if (a = 1 OR 2) maybe this helps your situation: if (in_array($a, array(1, 2))) echo "got i

[PHP] Short writage of clauses

2006-06-12 Thread Barry
Hi everyone! Well i do know that you can write IF as ( ? : ) but what i am asking about is something like this: if (a = 1 OR a = 2) is it anyway possible to write it like: if (a = 1 OR 2) I know this is wrong because "2" will always be true ... Any infos on that would be nice :) Greets