php - How to ceiling or floor a variable? -


i have tried use algorithms made other languages ceiling variables , flooring them, looked in php manual answers couldn't manage find answers finding floor / ceiling.

i have tried setting precision 0 in php.ini , didn't change anything.

i have tried 3 / 2 , want give me 1 (floor) answer or 2 (ceil)

to ceiling or floor variable simple using php builtin math functions:

$ceiling = ceil(1.5);   // ceiling of 3/2 2  $floor   = floor(1.5);  // floor of 3/2 1 

ceil takes float , returns float rounded nearest integer. floor takes float , returns float rounded down nearest integer. see:

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

http://php.net/manual/en/function.floor.php


Comments

Popular posts from this blog

PySide and Qt Properties: Connecting signals from Python to QML -

c# - DevExpress.Wpf.Grid.InfiniteGridSizeException was unhandled -

scala - 'wrong top statement declaration' when using slick in IntelliJ -