note 9012 added to strtr
| From: | herve at milk dot fr | Date: | Wed, 11 Oct 2000 11:21:35 +0000 |
| Subject: | note 9012 added to strtr | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6377@lists.php.net to get a copy of this message | ||
strtr() is useful when trying to convert a string from PHP to Javascript (as JS doesn't allow
linebreaks in string declarations) :
<script language="Javascript">
<?php
print("var js_string = \"%s\";",strtr($php_string,"\n\r\t\0","
");
?>
http://www.php.net/manual/function.strtr.php