PHP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingPHP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 26th, 2004, 08:13 AM
tarka tarka is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 tarka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
express 'between a range of numbers' in an 'if statement'

how would i express 'between a range of numbers' in a if statement. for example if i wanted to say between 100 and 1000, how would that be done????

Code:
function purchase_add_select_tel($add_select_tel_licence,$a  dd_select_tel) {
if ($add_select_tel < 99) {
return 0;
} else if ($add_select_tel 100 - 1000) {
$price = ($add_select_tel_licence/1000) * $add_select_tel;
return $price;
} else if ($add_select_tel > 1000) {
$2ndprice = ($add_select_tel_licence/2000) * $add_select_tel;
return $2ndprice;
}
}

Reply With Quote
  #2  
Old July 26th, 2004, 09:16 AM
kode_monkey kode_monkey is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 367 kode_monkey User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 m 21 sec
Reputation Power: 16
To test if var $x is between 100 - 1000 (inclusive) use the follow -

PHP Code:
if ($x >= 100 && $x <= 1000)
  echo 
'$x is between 100 and 1000 (inclusive); 


To do this exclusively remove the '=' signs from the above.

Hope this helps,

-KM-

Reply With Quote
  #3  
Old July 26th, 2004, 11:49 AM
tarka tarka is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 15 tarka User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks kode_monkey!

Reply With Quote
  #4  
Old February 17th, 2011, 08:27 PM
jaigmaxia jaigmaxia is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2011
Location: Peru
Posts: 1 jaigmaxia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 53 sec
Reputation Power: 0
Send a message via ICQ to jaigmaxia
Test, just a test

hi, new to the site, thanks.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingPHP Development > express 'between a range of numbers' in an 'if statement'


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap