Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You still need to do this:

<?php o($name); ?>

I've used this exact function in my own code, though I call it "h". Really sucks that we have to do this - not to mention that PHP's global namespace for functions means it's better to have long names that are more likely not to clash with third party code.



Actually you can use the <?= syntax to make it even more concise:

function o($name) { return(htmlspecialchars($name));}

<?=o($name)?>

which lo, and behold, looks a lot like the rails candidate below.


You can't write code for redistribution like that though as most PHP installations have that option disabled since ti inteferes with XML processing instructions.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: