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
a more elegant way? [message #174274] Mon, 30 May 2011 14:52 Go to previous message
geoff is currently offline  geoff
Messages: 8
Registered: April 2011
Karma:
Junior Member
Hello

No doubt there is a better way of expressing this?!

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 > 30 && $value < 41) {
$section_addressed = '4';
}
if ($value > 40 && $value < 51) {
$section_addressed = '5';
}
if ($value > 50 && $value < 61) {
$section_addressed = '6';
}
if ($value > 60 && $value < 71) {
$section_addressed = '7';
}
if ($value > 70 && $value < 81) {
$section_addressed = '8';
}
if ($value > 80 && $value < 91) {
$section_addressed = '9';
}
if ($value > 90 && $value < 101) {
$section_addressed = '10';
}
if ($value > 100 && $value < 111) {
$section_addressed = '11';
}
if ($value > 110 && $value < 121) {
$section_addressed = '12';
}

Cheers

Geoff
[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: Sat Nov 23 00:34:03 GMT 2024

Total time taken to generate the page: 0.03389 seconds