Solved

php check whole number

Posted on 2006-11-08
3
1,110 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

Easy Project Management (No User Manual Required)

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

760 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now