php_novice2007 Posted August 28, 2007 Share Posted August 28, 2007 Hi, Can I display a php number to only 1 decimal place? How? E.g. 43.564243 I want to display just 43.6 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/67035-displaying-function/ Share on other sites More sharing options...
hostfreak Posted August 28, 2007 Share Posted August 28, 2007 Look into <a href="http://www.php.net/round">PHP: Round</a> Quote Link to comment https://forums.phpfreaks.com/topic/67035-displaying-function/#findComment-336169 Share on other sites More sharing options...
piznac Posted August 28, 2007 Share Posted August 28, 2007 Try this: <?php $num = 43.564243; $rounded = round($num,2); echo $rounded; ?> Quote Link to comment https://forums.phpfreaks.com/topic/67035-displaying-function/#findComment-336176 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.