Jump to content

simple math


dreamwest

Recommended Posts

i think this is what your looking for, but i dont know anything about what percentage you want. What this percentage is telling yo is that the rent is 22% percent of the total purchase price. I am not sure if this is what you are looking for

<?php

$purchase = 44000;
$rent = 9860;

$percent = round($rent / $purchase * 100, 2); //this is wrong, it returns 4.3 but should be over 18

echo "Percentage is {$percent}%";

?>

Link to comment
https://forums.phpfreaks.com/topic/259926-simple-math/#findComment-1332249
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.