I have a form that the user enters in
for example, their first name and presses
the submit button.
My php3 code is suppose to take the
FirstName variable and right pad it with
spaces up to a length specified by me.
I have written a function that right
pads the FirstName variable, but only
if I don't attempt to use " " - it
works if I use say "@" char.
Below is my code.
Can someone please tell me why I can't
right pad with spaces?
function RightPadString($sTemp, $iMaxLength)
{
$iCount = 0;
$iLength = strlen($sTemp);
$sFixed = "";
$sPadding = "";
$sSpace = Chr(31);
for ($iCount = $iLength; $iCount < $iMaxLength; $iCount++)
{
$sPadding .= $sSpace;
}
$sFixed = $sTemp . $sPadding;
return $sFixed;
}