Re: preg_match() occurence position
| From: | Alexander Kuznetsov | Date: | Thu, 25 Jul 2002 11:46:31 +0000 |
| Subject: | Re: preg_match() occurence position | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-109476@lists.php.net to get a copy of this message | ||
Hello lallous,
Thursday, July 25, 2002, 3:40:32 PM, you wrote:
l> Hello,
l> Can I get the starting position of my string occurence when using any
l> regexps searching functions in PHP ?
l> for example:
l> $mem='this is a test';
l> preg_match('/test/', ...) should return me somehow: 10
l> Thanks
why regexps?
what about simple string fuctions in PHP?
for your example they will be more usefull:
strrpos - http://www.php.net/manual/en/function.strrpos.php
sample:
$text = "string";
echo strrpos($text, "r"); // must show 2 as result
--
Best regards,
Alexander Kuznetsov