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-...
Java: https://stackoverflow.com/questions/5741311/how-to-encode-sp...
Go: https://gist.github.com/brandonrachal/10605780
Rails: https://stackoverflow.com/questions/1600526/how-do-i-encode-...
c++ (get your own sax ready!): 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.