Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

INT function equivalent

Status
Not open for further replies.

mellenburg

Programmer
Aug 27, 2001
77
US
What is the PHP equivalent of the INT function which returns the interger portion of a number.

For example:

INT(3.14)=3
INT(7.99)=7
 
That'll be floor

floor (value)

note that echo floor(-1.6) will output -2
 
Mellenburg,
I think you can avoid the problem of negative number using the function intval(value).

Gaetano
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top