Re: Fw: Am stuck
| From: | Becoming Digital | Date: | Sat, 27 Sep 2003 17:27:58 +0000 |
| Subject: | Re: Fw: Am stuck | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164101@lists.php.net to get a copy of this message | ||
<?php
$name = "Chris";
$name = str_pad( $name, 40 );
?>
http://www.php.net/manual/en/function.str-pad.php
Edward Dudlik
Becoming Digital
www.becomingdigital.com
----- Original Message -----
From: "Chris Grigor" <aphrodit@iafrica.com>
To: "php" <php-general@lists.php.net>
Sent: Thursday, 25 September, 2003 09:17
Subject: [PHP] Fw: Am stuck
Sorry maybe I should elaborate
<?php
$name = "Chris";
$b = '5'; /* this is the value count of $name; */
for ($a=$b; $a<=40; $a++)
{
add a space to the end of $name; /* this then makes $name 40 charecters long (but what function do
I use to add on spaces?? */
}
?>
Good day all
I have a txt file that has values from various strings written to it.
What Im looking for is the following
$name = "Chris';
I need to do a count on $name so that it returns 5 letters. Then before writing it to the output
file I
know that it has to be 40 charecters long before it gets written.
So I know its 5 now I need automatically add another 35 empty spaces to it to make it 40 so that it
makes the
$name like this
$name = "Chris "; <---- if I do a count on
this it should be 40 charecters long....
Can anyone help out here???
Chris