Ive tried substr() but couldnt make it work. I just need $leadsmissed, $panswerrate, and $pcloserate to round to the nearest whole number and display that. I also need $prevenue to show the two digits past the decimal: xxx.xx
Am I missing something with the syntax of it? Im new to all this. Any help would be appreciated. Thanks!
<?php
$branches = $_POST['branches'];
$closerate = $_POST['closerate'];
$ticketsize = $_POST['ticketsize'];
$leadsperhour = .87;
$revenue = ($branches * $leadsperhour) * $closerate * $ticketsize;
$leadsmissed = $branches * $leadsperhour;
$panswerrate = .92 * $leadsmissed;
$pcloserate = $closerate * $leadsmissed;
$prevenue = $pcloserate * $ticketsize;
$result['string1'] = "Your company, on average, missed " . $leadsmissed . " leads in the past hour. ";
$result['string2'] = "With Pronexis, you would have talked to " . $panswerrate . " of those leads, closed " . $pcloserate . " of them, and received $" . $prevenue . " more revenue!";
echo json_encode($result);
?>
Rounding to the closest integer number:
$leadsmissed = round($leadsmissed);
$panswerrate = round($panswerrate);
$pcloserate = round($pcloserate);
Convert to float with 2 decimals
$prevenue = number_format($prevenue , 2);