PHP strip_tags only at the end of the string
Posted
by
Solomon Closson
on Stack Overflow
See other posts from Stack Overflow
or by Solomon Closson
Published on 2012-07-08T02:19:45Z
Indexed on
2012/07/09
3:16 UTC
Read the original article
Hit count: 209
Ok, well, I just want to use strip_tags
function on the very end of a string to get rid of any <br />
tags.
Here's what I have now, but this is no good because it strips these tags from everywhere in the string, which is not what I want. I only need them stripped out if it's at the end of the string...
$string = strip_tags($string, strtr($string, array('<br />' => ' ')));
How can I do this same thing, except only at the very end of a string??
Thanks guys!!
© Stack Overflow or respective owner