Solved

php check whole number

Posted on 2006-11-08
3
1,111 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
  • 2
3 Comments
 
LVL 2

Expert Comment

by:JonathanMT
ID: 17902208
0
 
LVL 2

Accepted Solution

by:
JonathanMT earned 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Suggested Solutions

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

776 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