untested!
?
if (strlen($word) 17) { $padding = 17-strlen($word); $word .= str_repeat('
', $padding); unset($padding); }
?
The reason for the if statement is that str_repeat will produce an error if
17-strlen($word) = 0 and that'll break your scriptof course you could
remove the if state if
On Mon, May 21, 2001 at 10:04:21AM -0500, Tolga thorr Orhon wrote :
One improvment:
$strpad = HELLO;
echo str_pad(substr($strpad,0,17),17);
why ?
- Markus
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL
Hello All,
I need to output a string that must always be 17 characters even if the inside value
is not.
Supose a have the HELLO word that is a 5 character string and I need to output HELLO
which is 17 characters.
How can I accomplish this in PHP4 ?
Has anyone ever did it?
On Sun, 20 May 2001 22:03:05 -0300, Carlos Fernando Scheidecker
Antunes ([EMAIL PROTECTED]) wrote:
Hello All,
I need to output a string that must always be 17 characters even if
the inside value is not.
Supose a have the HELLO word that is a 5 character string and I need
to output HELLO
4 matches
Mail list logo