note 76505 added to function.str-pad
| From: | Spudley at osu1 dot php dot net | Date: | Wed, 18 Jul 2007 15:47:54 +0000 |
| Subject: | note 76505 added to function.str-pad | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-128692@lists.php.net to get a copy of this message | ||
Warning: If your string includes non-ascii characters (eg the British pounds sign), str_pad() will
treat these as two characters when calculating the padding.
So for example:
<?php
str_pad($currency_symbol.$showtottopay,12," ",STR_PAD_LEFT);
?>
will produce a different length string depending on whether $currency_symbol is pounds or dollars.
Hope this helps someone -- it caused me a lot of problems with misaligned columns in my invoices
until I worked it out.
----
Server IP: 194.145.210.3
Probable Submitter: 212.84.170.86
----
Manual Page -- http://www.php.net/manual/en/function.str-pad.php
Edit -- https://master.php.net/note/edit/76505
Del: integrated -- https://master.php.net/note/delete/76505/integrated
Del: useless -- https://master.php.net/note/delete/76505/useless
Del: bad code -- https://master.php.net/note/delete/76505/bad+code
Del: spam -- https://master.php.net/note/delete/76505/spam
Del: non-english -- https://master.php.net/note/delete/76505/non-english
Del: in docs -- https://master.php.net/note/delete/76505/in+docs
Del: other reasons-- https://master.php.net/note/delete/76505
Reject -- https://master.php.net/note/reject/76505
Search -- https://master.php.net/manage/user-notes.php