Skip to content

Instantly share code, notes, and snippets.

@ScottPhillips
Created January 1, 2012 05:16
Show Gist options
  • Save ScottPhillips/1546328 to your computer and use it in GitHub Desktop.
Save ScottPhillips/1546328 to your computer and use it in GitHub Desktop.
Get the % Change between 2 numbers in PHP
<?php
function percentChange($oldNos = 0, $newNos = 0) {
$scratchSheet = ($newNos + 0) - ($oldNos + 0);
return round((($scratchSheet / $oldNos) * 100),2);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment