note 90149 added to function.pow

From: Date: Wed, 08 Apr 2009 07:54:56 +0000
Subject: note 90149 added to function.pow
Groups: php.notes 
Request: Send a blank email to php-notes+get-152940@lists.php.net to get a copy of this message
Here's a simple function to add leading zeros. function leading_zeros($value, $places){ if(is_numeric($value)){ for($x = 1; $x <= $places; $x++){ $ceiling = pow(10, $x); if($value < $ceiling){ $zeros = $places - $x; for($y = 1; $y <= $zeros; $y++){ $leading .= "0"; } $x = $places + 1; } } $output = $leading . $value; } else{ $output = $value; } return $output; } ---- Server IP: 209.41.74.194 Probable Submitter: 72.245.237.167 ---- Manual Page -- http://www.php.net/manual/en/function.pow.php Edit -- https://master.php.net/note/edit/90149 Del: integrated -- https://master.php.net/note/delete/90149/integrated Del: useless -- https://master.php.net/note/delete/90149/useless Del: bad code -- https://master.php.net/note/delete/90149/bad+code Del: spam -- https://master.php.net/note/delete/90149/spam Del: non-english -- https://master.php.net/note/delete/90149/non-english Del: in docs -- https://master.php.net/note/delete/90149/in+docs Del: other reasons-- https://master.php.net/note/delete/90149 Reject -- https://master.php.net/note/reject/90149 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#152940) next »