Re: Htmlentities vs htmlspecialchars
| From: | Jochem Maas | Date: | Wed, 26 Jul 2006 12:59:46 +0000 |
| Subject: | Re: Htmlentities vs htmlspecialchars | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-239803@lists.php.net to get a copy of this message | ||
Dave Goodchild wrote:
> Hi all. I know htmlspecialchars converts the smallest set of entities
> possible to generate valid HTML, and that htmlentities goes much
> further, so
> what is the difference? Is it not better to use htmlentities in every case,
> making htmlspecialchars somewhat redundant, or is there a performance
> tradeoff?
1 kind of performance: 'htmlentities' is less chars to type.
another kind of performance: 'htmlspecialchars' converts a *smaller* set of entities;
this assumes that the size of the set has a measurable impact on the time takento do a
conversion - I doubt that given the actual sizes of the respective entity conversion tables
that this is the case. okay so that's guess work ;-)
personally I always use htmlentities() and be done with it, I had the same 'redundant'
feeling some time back.
I wonder if anyone can given a solid answer to this?
>