NYCPHP Meetup

[PHP] Need an explanation as to what this line does...

John W. Holmes holmes072000 at charter.net
Sat Feb 1 17:13:43 EST 2003


>  $stuffArray[$i][value] = strtr($stuffArray[$i][value],
> array_flip(get_html_translation_table(HTML_ENTITIES)));
> 
> To be bluntly honest, I don't understand hardly any of it, and the PHP
> Manual isn't helping this time.. maybe I'm weekend-stupid or
something..

It converts HTML entities back to their original characters. Where
htmlentities() and htmlspecialchars() will take characters like <, >,
and & and turn them into &lt;, &gt;, and &amp, the code you have will
take those entities and turn them back into <, >, and &. 

It's all explained on the get_html_translation_table() manual page, if
you care to read the manual.

http://www.php.net/manual/en/function.get-html-translation-table.php

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/





More information about the talk mailing list