note 41059 deleted from function.sqlite-escape-string by cmb
| From: | cmb@php.net | Date: | Mon, 02 Nov 2020 14:58:57 +0000 |
| Subject: | note 41059 deleted from function.sqlite-escape-string by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-215727@lists.php.net to get a copy of this message | ||
Note Submitter: Minots Estichá <minots at D0X dot de>
----
sometimes i you have to escape an array instead of a string.
my function to do it works like:
array sqlite_escape_array ( &array string)
<?php
function sqlite_escape_array(&$arr)
{
while ( list($key, $val) = each($arr) ):
if ( (strtoupper($key)!=$key OR "".intval($key) == "$key") &&
$key!="argc" and $key!="argv"):
if (is_string($val)):
$arr[$key]=sqlite_escape_string($val);
endif;
if (is_array($val)):
$arr[$key]=sqlite_escape_array($val);
endif;
endif;
endwhile;
return $arr;
}
?>