note 77659 added to function.sprintf

From: Date: Fri, 07 Sep 2007 06:29:21 +0000
Subject: note 77659 added to function.sprintf
Groups: php.notes 
Request: Send a blank email to php-notes+get-130285@lists.php.net to get a copy of this message
/** This function returns a formated string with the legnth you specify @string holds the string which you want to format @len holds the length you want to format **/ function formatString($string, $len) { if (strlen($string) < $len) { $addchar=($len - strlen($string)) ; for ($i = 0; $i < $addchar; $i++) { $string=sprintf("$string%s", "0"); } } if (strlen($string) > $len) { $string=substr($string,0,$len); } return $string; } ---- Server IP: 69.147.83.197 Probable Submitter: 202.163.69.60 ---- Manual Page -- http://www.php.net/manual/en/function.sprintf.php Edit -- https://master.php.net/note/edit/77659 Del: integrated -- https://master.php.net/note/delete/77659/integrated Del: useless -- https://master.php.net/note/delete/77659/useless Del: bad code -- https://master.php.net/note/delete/77659/bad+code Del: spam -- https://master.php.net/note/delete/77659/spam Del: non-english -- https://master.php.net/note/delete/77659/non-english Del: in docs -- https://master.php.net/note/delete/77659/in+docs Del: other reasons-- https://master.php.net/note/delete/77659 Reject -- https://master.php.net/note/reject/77659 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#130285) next »