4 ms·
Hi, great post ! Suggestions : Sanitizing HTML Please explain why you prefer htmlspecialchars over htmlentities Please explain why you should htmlspecialcha
by vhf 14y ago
Hi, great post !
Suggestions :
Sanitizing HTML
Please explain why you prefer htmlspecialchars over htmlentities
Please explain why you should htmlspecialchars when outputting content, but never use it when inserting to database (obvious for us, not for your reader)
Checking for null values
Please explicit that === should also be used when compairing to false (problem is the same as with null)
Please use Yoda condition in your example or even better explain why (it's also a best practice in PHP (also recommanded by WordPress Coding guidelines and several other frameworks, by example))
- acabal 14y agoThanks, I've added a note about htmlentities. Actually it's better to use htmlentities, and I got the two functions confused while writing! Another reason why such a guide is needed :)