Core Function StrNew
From Sputnik Wiki
StrNew( <char>, <length> )
Contents |
Description
Create a new string of a given length filled with a given char.
Parameters
char
What char should populate the new string.
length
How big the new string should be.
Return Value
Success: The new string.
Failure: null
Remarks
None.
Example
Normal string
$Str = StrNew('T', 15); $Str[0] = 'A'; // Set first char to A $Str[1] = 'B'; // Set second char to B echo $Str; // Prints: ABTTTTTTTTTTTTT // Of course you could just make the string like // $Str = "ABTTTTTTTTTTTTT"; // OR // $Str = "AB" . ('T' x 13);