3 ms·
Here you go: function o($name) { echo htmlspecialchars($name); } o($name);
by breck 18y ago
Here you go:
function o($name) {
echo htmlspecialchars($name);
}
o($name);
- simonw 18y agoYou 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.
- deleted 18y ago[deleted]
- ojbyrne 18y agoActually 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.
- simonw 18y agoYou can't write code for redistribution like that though as most PHP installations have that option disabled since ti inteferes with XML processing instructions.