I often use php for my own sites because the language is so simple and because I have access to the most up-to-date library. The problem is that I have to put in a lot of text myself and I lose the opportunity to get creative.
A few years ago I wrote a little function that was designed to convert any of these HTML entities into plain text. It is a lot of work but it’s quick and it’s fun, which is always a plus. I never know what I’m going to come up with next, so I’ve made it a habit of trying to put anything in there that has to do with the game I’m working on.
The problem is that not every HTML entity is valid in every browser. Some are specific to certain browsers, others are universal and therefore don’t need to be handled with any special care. This includes things like which in the latest browsers, when I try to use it, come up as invalid.
So in order to make sure you can still use what’s in your code without having to worry about browsers, you can use the php htmlentities function. It gives you the ability to use HTML entities in your code but not every browser will have support for it. (It’s pretty much the only way to avoid having to deal with weird problems in a browser you might really want a new one to have.
I had to google this in my head the other day because I was told that I needed to use htmlentities on a variable I was using in a PHP file, but I couldn’t figure out why. Turns out that the problem was that a lot of the browsers were out of the range of what htmlentities supported. I had to find a new browser and get the browser to support this feature.
The problem is that not all browsers support htmlentities. There are a few browsers that only support it if you use the htmlspecialchars function. When this is the case, you can’t have text in your string that contains html characters, so you have to make sure the text you’re passing to the htmlspecialchars function is encoded as HTML entities.
Yes, it would have been nice if it was supported everywhere. But I guess the real problem is that the only browser that supports it is IE.
I mean, I know they were originally targeted for IE, but as we all know, it would have been nice if it’d have had a wider audience.
It’s been supported in all major browsers (not just IE). But the problem is that IE is the only browser that actually decodes the characters. The problem is that when you use htmlentities on a string that contains a lot of HTML characters, you end up with a lot of empty strings. This is a problem because, as you can imagine, there are a lot of empty strings in a string that contains HTML entities.
In fact a lot of HTML entities are just regular quotes…