I have a input string like:
$str = ':this is a applepie :) ';
How can I remove the first occurring : with PHP?
:
Desired output: this is a applepie :)
this is a applepie :)
The substr() function will probably help you here:
substr()
$str = substr($str, 1);
Strings are indexed starting from 0, and this functions second parameter takes the cutstart. So make that 1, and the first char is gone.
1.4m articles
1.4m replys
5 comments
57.0k users