I need to remove a substring of a string, but only when it is at the END of the string.
for example, removing 'string' at the end of the following strings :
"this is a test string" -> "this is a test "
"this string is a test string" - > "this string is a test "
"this string is a test" -> "this string is a test"
Any idea's ? Probably some kind of preg_replace, but how??
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…