--- In PHP-OOP@yahoogroups.com, Vish <emacsian ...>
wrote:
>
> mamontesines wrote:
> > I have a problem on programming, Iam trying to
create a function that
> > can check whether a number is
> >
> > 0 1 2
> > 6 7 8
> > 12 13 14
> > 18 19 20
> > 24 25 26
> >
> > the function will just return true if the number
is one of the above
> > but without mentioning the numbers staticly
> >
> > meaning not like this:
> > if( $num==0 && $num==1 && $num==2
&& $num==6 ..and so on )
> >
> > but something like this:
> > function progression( $num, $diffBetween )
> > {
> > if( $num%2 )
> > return true ;
> > else
> > return false ;
> > }
> >
> > can anyone help?....
>
> If thats the only series of numbers that you want to
check then perhaps
> put it in an array and check w/ the function
in_array().
> And if there are more numbers you can add to that
array. Hope this
helps.
>
> --
> Vish
>
> Statistics: The only science that enables different
experts using
the same figures to draw different conclusions. - Evan Esar
>
print ($num%6)<3; <-- this is what i was looking for
....thanks
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.
yahoo.com/group/PHP-OOP/
<*> To unsubscribe from this group, send an email to:
PHP-OOP-unsubscribe@yahoogroups.com
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.c
om/info/terms/
|