A
Anonymous
Guest
I'm stuck again on something which ought to be really easy. But, having soent an hour perusing the manual, I'm not closer to the answer.
Here's the problem (simplified).
I have a string which will always include a number of colon ":" characters. I want to replace the last colon in the string with a string. For example "straw".
$haystack = "Here is a string with : some : colons : in it"
$pos = strripos($haystack, ":");
Now I know the position of the last colon in $haystack.
So how do I replace that colon with "straw"?
$haystack = "Here is a string with : some : colons straw in it"
Thanks in advance. I know I'm going to kick myself!
Martin
Here's the problem (simplified).
I have a string which will always include a number of colon ":" characters. I want to replace the last colon in the string with a string. For example "straw".
$haystack = "Here is a string with : some : colons : in it"
$pos = strripos($haystack, ":");
Now I know the position of the last colon in $haystack.
So how do I replace that colon with "straw"?
$haystack = "Here is a string with : some : colons straw in it"
Thanks in advance. I know I'm going to kick myself!
Martin