Re: str_pad
| From: | pete M | Date: | Fri, 26 Sep 2003 12:03:55 +0000 |
| Subject: | Re: str_pad | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164026@lists.php.net to get a copy of this message | ||
$dbranch = str_pad($line->dbranch_no, 6, STR_PAD_LEFT);
there's a aslo
$dbranch = str_pad($line->dbranch_no, 6, STR_PAD_BOTH);
and that pads it in the centre
pete
Chris Grigor wrote:
This should be quite an easy task for some... say for example $line->dbranch has a value of 3 I know that 3 spaces will be added on to the end of $dbranch $dbranch = str_pad($line->dbranch_no, 6);so the value of $dbranch should look like "3 " Is there anyway to right justify the 3 using str_pad .. example still put the 3 spaces in but at the beginning??? so it looks like " 3"Chris