Skip to content

Instantly share code, notes, and snippets.

@hafizbadrie
Last active August 29, 2015 13:57
Show Gist options
  • Save hafizbadrie/9616300 to your computer and use it in GitHub Desktop.
Save hafizbadrie/9616300 to your computer and use it in GitHub Desktop.
/* finding top ordinate value in a graph */
/* let's say $a is the highest value in data */
$a = 25;
$base = pow(10, (strlen($a) - 1));
$max = floor($a/$base) * $base;
$mod = $max%3;
$addition = ($mod == 0) ? 0 : 3 - $mod;
$max += $base * $addition;
echo $max;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment