Jochem Maas wrote: ...
A better example code would be: $string = 'period.backslash\\plus+star*question?lbracket[rbracket]carat^lparen(rparen)dollar$';
echo "<PRE>", quotemeta($string), "</PRE>";
Interesting aside... with the test string above, I noticed that backslash\\ only resolved to two backslashes. I thought there would be
thats correct...
echo "\\"; // shows one backslash
Well in the example above it was a single quote, not a double quote. But either way... I would have thought there would be a 1:1 relationship in the quotemeta translation (either quote all of them, or assume they are all quoted already).
4. It seems that quotemeta will resolve \ and \\ to \\, \\\ and \\\\ resolve to \\\\, etc.
See above. I would think (given my own common sense as well as the man page for quotemeta) that there would be a quote added to each of these. But the results don't quite match this...
-- Teach a man to fish...
NEW? | http://www.catb.org/~esr/faqs/smart-questions.html STFA | http://marc.theaimsgroup.com/?l=php-general&w=2 STFM | http://www.php.net/manual/en/index.php STFW | http://www.google.com/search?q=php LAZY | http://mycroft.mozdev.org/download.html?name=PHP&submitform=Find+search+plugins
Attachment:
signature.asc
Description: OpenPGP digital signature