4 ms·
"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not
by ransom1538 9y ago
"As for coding yes—one issue I have is that not using PHP exclusively I get confused by the fact that the opposite of html_entity_decode is htmlentities and not html_entity_encode"
Ah yes. You will probably have to hit 'tab' on your IDE with php - to type "html_entity_encode". But if this is too hard - Here you go,
Try it out in python (careful of the 2/3 quirks!):
Python:
https://stackoverflow.com/questions/275174/how-do-i-perform-html-decoding-encoding-using-python-django https://stackoverflow.com/questions/275174/how-do-i-perform-...
Java:
https://stackoverflow.com/questions/5741311/how-to-encode-special-chars-in-html-content https://stackoverflow.com/questions/5741311/how-to-encode-sp...
Go:
https://gist.github.com/brandonrachal/10605780 https://gist.github.com/brandonrachal/10605780
Rails:
https://stackoverflow.com/questions/1600526/how-do-i-encode-decode-html-entities-in-ruby https://stackoverflow.com/questions/1600526/how-do-i-encode-...
c++ (get your own sax ready!):
http://forums.codeguru.com/showthread.php?448809-C-Replacing-HTML-Character-Entities http://forums.codeguru.com/showthread.php?448809-C-Replacing...
Again the anti-php movement in action. A bunch of devs who used php 15 years ago.
- Mithaldu 9y agoDoes stacking of PHP's ternary still result in hard-to-predict behavior?
- _cereal 9y agoYes, documentation still suggest to avoid such practice, see the second note here: http://www.php.net/manual/en/language.operators.comparison.php#language.operators.comparison.ternary http://www.php.net/manual/en/language.operators.comparison.p...
- kod 9y agoThe java apache commons example uses methods named escapeHtml and unescapeHtml Seems pretty sensible. How is that not support for the claim that php's method naming sucks by comparison?
- ransom1538 9y agoIf you don't want functions you use daily being built in and easy to use - just include a 3rd party one with composer. It will be namespaced properly.
- EGreg 9y agoThe guy literally said "PHP's problem IMHO is that I wouldn't be able to use it if it wasn't for autocomplete" Why are you arguing against a strawman?
- nkkollaw 9y agoI have no idea what you are talking about. How would hitting tab change html_entity_encode into htmlentities?
- joshmanders 9y agoIf you start typing `html` trying to get to `html_entity_encode` you'll notice a dropdown which will show you the right method to use. Unless you use notepad.exe or something. https://i.imgur.com/YYXkkNS.png https://i.imgur.com/YYXkkNS.png
- nkkollaw 9y agoI see, but htmlentities is just an example. It's a coincidence that they both start with 'html'...
- joshmanders 9y agoUnless you only write a few lines of PHP every couple of days then you quickly learn what is what, and order of the function signature... I left for 2 years and came back and took me 3 days to get back to the state I was before.