I'll read up on these and see how to incorporate them into the function.
(edit) Without knowing what is installed on the webserver, for example, if the space is being rented from a hosting company, the presence of the Zend Framework and mod_security cannot always be guarenteed, but I'll see about looking for a host with these features, as I'm coding a shopping website.
I have attached an improved version of my noSQL script. The function now takes 3 arguments - the first is the string to be processed, and the others are boolean values.
The function always escapes slashes, inverted commas and double inverted commas.
If the second argument is true, the function removes semi-colons, asterisks, double minus signs (SQL comment delimeters) and those strange angled inverted commas used for enclosing column names and table names.
If the third argument is true, the function removes certain SQL keywords. Since it uses str_ireplace, it only works with PHP5 or later.