FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » a more elegant way?
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: a more elegant way? [message #174276 is a reply to message #174274] Mon, 30 May 2011 15:03 Go to previous messageGo to previous message
dougatmilmacdotcom is currently offline  dougatmilmacdotcom
Messages: 24
Registered: May 2011
Karma:
Junior Member
In article <0mb7u694aqigfmbdi5ic943mv189ptsh7f(at)4ax(dot)com>, geoff(at)invalid(dot)invalid wrote:
> Hello

Please disregard my previous post; I hit send a bit too quickly, before
reviewing what I'd written.
>
> No doubt there is a better way of expressing this?!

Yes, there is.
>
> Pointers please ...
>
> if ($value > 0 && $value < 11) {
> $section_addressed = '1';
> }
> if ($value > 10 && $value < 21) {
> $section_addressed = '2';
> }
> if ($value > 20 && $value < 31) {
> $section_addressed = '3';
> }
[...]
> if ($value > 110 && $value < 121) {
> $section_addressed = '12';
> }

if ($value > 0 && $value < 121) {
$section_addressed = floor (($value - 1) / 10) + 1;
}
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: database access
Next Topic: Storing parsed XML-elements as blobs
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Tue Nov 26 21:00:48 GMT 2024

Total time taken to generate the page: 0.04232 seconds