Adek336 wrote:
Just before I find the proper chapter in the manual, how do I manage single characters in a string, just like good-ol' C text[offset-1] ?
text{offset-1} will do the same thing.
Quote:
Is a php string null-terminated?
Probably, I haven't bothered checking.
Quote:
Is there any function like memmove?
No. You can't access memory directly. About the closest you could get would be to just make a copy of the variable.
Quote:
How do I allocate more space for a string when I want to add a char?
Just concatenate it. Eg $String = $String . $Char
The interpreter will take care of the messy memory allocation details.
Quote:
Are there functions to prepend data in the middle of a string? And most basically, are there any prebuilt functions which would change any "\n" into "<br>"?
Yes. In fact there's a specific PHP function for exactly that purpose ("\n" to "<br>"), but if you wanted a general way of replacing things in strings you'd use a regular expression.
Code:
eg
$string = ereg_replace("\n", "<br />", $string);
I strongly recommend grabbing a copy of the manual (
http://www.php.net/download-docs.php) and running through some tutorials. Pretty much all of the standard C functionality (Aside from memory allocation and pointers) is there in one way or other.