2DaysAway Posted October 4, 2008 Share Posted October 4, 2008 Ok, I have a list of these functions on a separate php file and I use the include() statement on another php file to load this function page into it. The functions work properly but for every function I use a 0 appears at the top of the DIV the include() statement is in. So, I have exactly nine 0's in a row because I have nine separate functions. Any ideas what is going on here? lol. $mint = $user["medicine"]; function mformat($number) { $suffix = array('', ' K', ' M', ' B',' T', ' Q'); $max = count($suffix) - 1; while ($number >= 1000 and $i < $max){ $number /= 1000; $i++; } $number = round($number, 2); return $number . $suffix[$i]; } echo mformat($mint); Quote Link to comment Share on other sites More sharing options...
DarkWater Posted October 4, 2008 Share Posted October 4, 2008 Must be coming from somewhere else, because I just did: <?php $mint = 56000; function mformat($number) { $suffix = array('', ' K', ' M', ' B',' T', ' Q'); $max = count($suffix) - 1; while ($number >= 1000 and $i < $max){ $number /= 1000; $i++; } $number = round($number, 2); return $number . $suffix[$i]; } echo mformat($mint); And it worked fine. Are you sure $user['medicine'] is not null? Quote Link to comment Share on other sites More sharing options...
2DaysAway Posted October 4, 2008 Author Share Posted October 4, 2008 Null is set to no. Quote Link to comment Share on other sites More sharing options...
2DaysAway Posted October 4, 2008 Author Share Posted October 4, 2008 I'm looking a few things, i'll get back when I see something.... Quote Link to comment Share on other sites More sharing options...
PFMaBiSmAd Posted October 4, 2008 Share Posted October 4, 2008 You are probably echoing a false value (treated as a number). For anyone in a forum to help, you would need to post the relevant code that is producing and outputting content immediate prior to the <div>, i.e. the code responsible for the point in the output where the zero is appearing. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.