Reputation: 17713
I don't know if this question has been already asked! It really seems to be new! I found something similar here, but it is for Java, not PHP.
Here follows my problem. On the client-side, I'm using TinyMCE to get a long text. On the server-side, I extract the first n words from that string for listing purpose.
In particular, the string returned contains HTML code, that I remove by using the PHP strip_tags()
function, and it also contains ASCII characters (e.g.
for spaces).
Is there any PHP function that automatically convert all the ASCII contained in a string or capable to detect all the ASCII code in a string?
In the first case all would be easy; in the latter I should find the ASCII and then replace it with the chr()
function.
Upvotes: 0
Views: 2969
Reputation: 25552
Check the function html_entity_decode()
From the documentation :
html_entity_decode() is the opposite of htmlentities() in that it converts all HTML entities in the string to their applicable characters.
Upvotes: 1