How do I get a float value when dividing two integers? (PHP)
问题 Hi I am trying to divide two integers ex: 12/13 but I always get a whole integer 1 not a decimal number. I tried type casting the values to float before hand with no success. Basically all I want is a decimal result like: 0.923... $x = 12; $y = 13; echo $value = $x / $y; //Would like to see 0.923 not 1 回答1: Under normal circumstances your code should return the floating value 0.923076 ... The reason you get a rounded integer might be because you have your ini setting for "precision" set to 0