note 129634 added to mysqli.real-escape-string
| From: | phpsychic | Date: | Wed, 03 Jul 2024 16:45:33 +0000 |
| Subject: | note 129634 added to mysqli.real-escape-string | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221406@lists.php.net to get a copy of this message | ||
Replacement function (~ 300% as fast as mysqli_real_escape_string), tested on PHP 8.2, amd64, Sury
repo:
<?php
define('fast_real_escape_string_map',
[chr(0)=>'\\0',"\n"=>"\\n","\r"=>"\\r",'\\'=>'\\\\',"'"=>"\\'",'"'=>'\\"',chr(26)=>'\\Z']);
function fast_real_escape_string(string $s) {
return strtr($s,fast_real_escape_string_map);
}
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 151.19.19.133)
----
Manual Page -- https://php.net/manual/en/mysqli.real-escape-string.php
Edit -- https://main.php.net/note/edit/129634
Del: integrated -- https://main.php.net/note/delete/129634/integrated
Del: useless -- https://main.php.net/note/delete/129634/useless
Del: bad code -- https://main.php.net/note/delete/129634/bad+code
Del: spam -- https://main.php.net/note/delete/129634/spam
Del: non-english -- https://main.php.net/note/delete/129634/non-english
Del: in docs -- https://main.php.net/note/delete/129634/in+docs
Del: other reasons-- https://main.php.net/note/delete/129634
Reject -- https://main.php.net/note/reject/129634
Search -- https://main.php.net/manage/user-notes.php