I've got a string and I'd like to get everything after a certain value. The string always starts off with a set of numbers and then an underscore. I'd like to get the rest of the string after the underscore. So for example if I have the following strings and what I'd like returned:
"123_String" -> "String"
"233718_This_is_a_string" -> "This_is_a_string"
"83_Another Example" -> "Another Example"
How can I go about doing something like this?
The
strpos()
finds the offset of the underscore, then substr grabs everything from that index plus 1, onwards.If you also want to check if the underscore character (
_
) exists in your string before trying to get it, you can use the following: