PDA

View Full Version : convert decimal numbers



Drunken
June 8th, 2003, 06:18 PM
In php i am using this to convert an decimal number to integer:





$contpag = (int) ($cont/10);




if $cont = 17 then the result that we have is 1.7 and when convert to integer is 1, but i want that the final result to integer is 2...

thanks!

:thumb:

ahmed
June 8th, 2003, 06:25 PM
use the ceil function :)

http://ca.php.net/manual/en/function.ceil.php

Drunken
June 8th, 2003, 06:39 PM
thks it work as i want :D