While I was developing Jtwig, I’ve noticed that Java doesn’t have a similar strip_tags function. It was also very difficult to find a faithful implementation.
In fact, the only valid implementation I’ve found is the Resmus Stratulat’s implementation, which is simple, but different. For example, in case of comments, it will not remove the entire comment, instead it will remove just the comment tags, making the comment content visible.
As so, I’ve decided to implement the same algorithm found in PHP source.