Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

php check whole number

Posted on 2006-11-08
3
Medium Priority
?
1,119 Views
Last Modified: 2012-05-05
how do I check to see if a number is a whole number and not a decimal?
0
Comment
Question by:jackjohnson44
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 2

Expert Comment

by:JonathanMT
ID: 17902208
0
 
LVL 2

Accepted Solution

by:
JonathanMT earned 2000 total points
ID: 17902221
or to check for input from a form etc. (where the var type will be a string) : http://uk2.php.net/manual/en/function.is-numeric.php#69366
0
 

Author Comment

by:jackjohnson44
ID: 17902255
your first comment didn't work
I found the answer

            if(is_numeric($order_quantity))
                  {
                  if ( ((int)$order_quantity) != ((float)$order_quantity) )
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to count occurrences of each item in an array.

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question