Michdd Posted November 15, 2008 Share Posted November 15, 2008 How can I move a decimal in php of a number, or in other words, convert a number into a percentage. Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/ Share on other sites More sharing options...
AndyB Posted November 15, 2008 Share Posted November 15, 2008 divide it by a hundred!! Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691004 Share on other sites More sharing options...
Michdd Posted November 15, 2008 Author Share Posted November 15, 2008 If I divide 1 by 100 I get 0.01, and 1 = 100%. Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691006 Share on other sites More sharing options...
Garethp Posted November 15, 2008 Share Posted November 15, 2008 Times by a hundred then Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691007 Share on other sites More sharing options...
Garethp Posted November 15, 2008 Share Posted November 15, 2008 Times by 10 to move the decimal point back one place Divide to move it forwards 1.00 * 10 = 10.0 .35 * 10 * 10 = 35.0 .56 / 10 = .056 Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691010 Share on other sites More sharing options...
.josh Posted November 15, 2008 Share Posted November 15, 2008 ($x / $y) * 100 example: If you have 65 beans, and 23 are black and 42 are white, what percentage of black and white beans are there? (23 / 65) * 100 = 35.38% black (42 / 65) * 100 = 65.63% white Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691014 Share on other sites More sharing options...
jordanwb Posted November 15, 2008 Share Posted November 15, 2008 Didn't we cover how to make percentages in like grade 3? Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691017 Share on other sites More sharing options...
Garethp Posted November 16, 2008 Share Posted November 16, 2008 Grade 3? No, that was Long Division. Percentages was like, waaaay before... Link to comment https://forums.phpfreaks.com/topic/132888-moving-a-decimal-in-a-number/#findComment-691047 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.