Hello everyone,
I've read, in the manual of PHP, about this function, i.e. quotemeta(string $str).
This function

Returns a version of str with a backslash character (\) before every character that is among these:
. \ + * ? [ ^ ] ( $ )

Now, I understand what it says, but I don't understand two things. First, where could this function be useful? And second, what are meta characters in PHP?
Thank you.

Recommended Answers

All 4 Replies

That's can help from hacking if you get any strings from user's forms.

Any strings like what? Would you please give me some example?

That function can help you protect from sql injection.
For example, if in your script enters $_POST and then put in a sql query you may protect many ways of hacking.
About sql inj: http://en.wikipedia.org/wiki/SQL_injection

Also this function can be useful in regular expressions.
Analog of this function is addslashes()

Aha, thanks a lot.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.