note 64353 added to function.htmlspecialchars

From: Date: Wed, 12 Apr 2006 20:05:15 +0000
Subject: note 64353 added to function.htmlspecialchars
Groups: php.notes 
Request: Send a blank email to php-notes+get-107926@lists.php.net to get a copy of this message
<?php // Escapes strings to be included in javascript function jsspecialchars($s) { return preg_replace('/([^ !#$%@()*+,-.\x30-\x5b\x5d-\x7e])/e', "'\\x'.(ord('\\1')<16? '0': '').dechex(ord('\\1'))",$s); } ?> <script> var some_variable = '<?= jsspecialchars($_GET['some_variable']) ?>'; </script> ---- Server IP: 64.71.164.2 Probable Submitter: 71.210.6.19 ---- X-Spam-Status: No, hits=4.0 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER, HTML_20_30,HTML_MESSAGE autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php Edit -- http://master.php.net/note/edit/64353 Del: integrated -- http://master.php.net/note/delete/64353/integrated Del: useless -- http://master.php.net/note/delete/64353/useless Del: bad code -- http://master.php.net/note/delete/64353/bad+code Del: spam -- http://master.php.net/note/delete/64353/spam Del: non-english -- http://master.php.net/note/delete/64353/non-english Del: in docs -- http://master.php.net/note/delete/64353/in+docs Del: other reasons-- http://master.php.net/note/delete/64353 Reject -- http://master.php.net/note/reject/64353 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#107926) next »