note 24527 added to function.str-pad

From: Date: Tue, 20 Aug 2002 15:23:34 +0000
Subject: note 24527 added to function.str-pad
Groups: php.notes 
Request: Send a blank email to php-notes+get-35255@lists.php.net to get a copy of this message
When provided with a string of characters as the pad value, str_pad uses all the characters as fill, and can leave partial strings. (eg. If the pad value is 'ABC' and it needs 5 characters to pad with, it outputs 'ABCAB'.) This is a problem when you want to pad with non-breaking spaces, the code for which is 6 characters long. This can be resolved by first padding the string with a single character that won't be found in the strings such as * then doing a str_replace of * with  . -- http://www.php.net/manual/en/function.str-pad.php http://master.php.net/manage/user-notes.php?action=edit+24527 http://master.php.net/manage/user-notes.php?action=delete+24527 http://master.php.net/manage/user-notes.php?action=reject+24527

« previous php.notes (#35255) next »