clathrun
11-10-2011, 09:19 PM
Hi, I have a question about regular expression.
$ means matching from the end of a string and ^ from the beginning. However, why does the following expression return failure?
$mode = "/^php$/";
$string = "phpphp";
preg_match($mode, $string);
what I think is that both the beginning and end contain 'php', so it should returns 1, but it doesn't.
Thanks a lot,
$ means matching from the end of a string and ^ from the beginning. However, why does the following expression return failure?
$mode = "/^php$/";
$string = "phpphp";
preg_match($mode, $string);
what I think is that both the beginning and end contain 'php', so it should returns 1, but it doesn't.
Thanks a lot,