Richard Lynch wrote:
<?php
preg_match('#\\#','any-string'); => warning

This seemed strange:
   warnings with 2 and 6 backlashes

For 2 backslashes, PHP "ate" the 2 backslashes, and handed PCRE #\#,
and PCRE does not like that at all.

Yet preg_match('#\\#','any-string'); does *not* throw a
warning when I run the 2nd script - the one where I call it
in the loop.

   no warnings with 3, 7
   warning with 5 but not with 3 and 7.

PHP and PCRE are doing their damndest to make sense of the garbage you
typed, but if you type garbage, you get garbage.
http://us.php.net/manual/en/language.types.string.php

But PHP doesn't appear to be consistent. In the 2nd script, I *do* get warnings with 3 and 7 slashes.

PHP can't be inconsistent. So there must be some semantic difference in my 2 scripts which unfortunately is eluding me.

Cheers

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to