Decode/unencode/uncode html entities using php as bash one-liner

Alec Jacobson

September 15, 2011

weblog/

Here's a very simple one-liner that takes input from standard in and decodes html entities:
php -R 'echo html_entity_decode($argn)."\n";'
So this example
echo ""Watson & Crick"" | php -R 'echo html_entity_decode($argn)."\n";'
produces:
"Watson & Crick"