On Thu, 2004-10-28 at 09:32, Phpu wrote:
> How to add a specified number of spaces to a string
>
> I use this but won't work if $spaces is less than the length of the $string
>
> $string = "bla bla bla";
> $spaces = 5;
> $string = str_pad($string, $spaces, " ");
Assuming you don't want padding since the above doesn't generate what
you want... try the following:
$string = "bla bla bla";
$spaces = 5;
$string .= str_repeat( ' ', 5 );
Cheers,
Rob.
--
..
| InterJinn Application Framework - http://www.interjinn.com |
::
| An application and templating framework for PHP. Boasting |
| a powerful, scalable system for accessing system services |
| such as forms, properties, sessions, and caches. InterJinn |
| also provides an extremely flexible architecture for |
| creating re-usable components quickly and easily. |
`'
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php