giraffemedia Posted July 23, 2008 Share Posted July 23, 2008 Hi I'm struggling with knowing how to use fractions i.e. 1/3, 1/8 within php and mysql and would much prefer to use decimals. is it possible to use/insert recurring numbers in php or mysql. I would like to add all of these up at a later stage so that 1/3, 2/3, 1/3, 1/3 and 1/3 added together would equal 2. I'd be very grateful if anyone could point me in the right direction. Regards James Link to comment https://forums.phpfreaks.com/topic/116227-php-and-mysql-with-fractionsrecurring-numbers/ Share on other sites More sharing options...
discomatt Posted July 23, 2008 Share Posted July 23, 2008 <?php $a = 1/3; $b = 2/3; $c = $a + $b; echo $c; ?> Outputs '1' Link to comment https://forums.phpfreaks.com/topic/116227-php-and-mysql-with-fractionsrecurring-numbers/#findComment-597616 Share on other sites More sharing options...
giraffemedia Posted July 23, 2008 Author Share Posted July 23, 2008 he he - simple as that!! Thanks Matt Link to comment https://forums.phpfreaks.com/topic/116227-php-and-mysql-with-fractionsrecurring-numbers/#findComment-597626 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.