function js_escape($str){for($i=0,$l=strlen($str),$new_str='';$i<$l;$i++){$new_str.=(ord(substr($str,$i,1))<16 ? '\\x0':'\\x').dechex(ord(substr($str,$i,1)));}return$new_str;}
Example:
$var='"Convinced myself, I seek not to convince." -Edgar Allan Poe';
1 comment
Thank you very much dude!!! It showed me some way to my problem. Have a great day.
thanks,
Sreedhar
Leave a Reply