note 14354 added to function.str-pad.php
| From: | bert at catsburg dot com | Date: | Fri, 27 Jul 2001 11:29:55 +0000 |
| Subject: | note 14354 added to function.str-pad.php | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-15938@lists.php.net to get a copy of this message | ||
The remark from mics.anders is not correct since str_repeat is also not available before PHP4. I
always use the following substr construct:<br>
$mystr = substr("0000",0,3-strlen($mystr)) . $mystr;
// "0000" = the string with padding chars
// 3 = maxlength where to pad to
http://www.php.net/manual/en/function.str-pad.php