[ale] PHP rounding in an imagestring

William Bagwell rb211 at tds.net
Sun Dec 28 11:24:19 EST 2014


Is this even possible? Warning, dove in and spliced code snippets from 
various sources with zero experience:-O Must say PHP is an order of 
magnitude easier to learn than Perl. And two orders less headache inducing!

On a forum where many of the regulars have signature banners with statistics 
and stuff related to the forums topic. Wanting one that is totally unique so 
started with 
     $now = time(); // or your date as well
     $your_date = strtotime("2010-01-01");
     $datediff = $now - $your_date;
     echo floor($datediff/(60*60*24));
modified the forth line to match some code found elsewhere.
     imagestring($im, 3, $left_margin, 18, $datediff/(60*60*24), $black);
Amazingly it works but returns 8 unneeded decimal places. Nothing I tried 
would remove them and in searching I found a completed script on a rival 
forum for the same topic. They declare every thing first so no math occurs 
inside an imagestring. Probably the route I need to take but want to ask 
before abandoning my much shorter script.
-- 
William
    



More information about the Ale mailing list