note 95822 deleted from function.preg-match by danbrown
| From: | danbrown@php.net | Date: | Sun, 24 Jan 2010 00:28:32 +0000 |
| Subject: | note 95822 deleted from function.preg-match by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-165246@lists.php.net to get a copy of this message | ||
Note Submitter: fusionstream at gmail [dot]com
----
I don't know about you guys but some of the examples in this page and it's resultant code
seem wrong in my browser.
preg_match is able to search for a regex pattern and return it's offset:
$str = "abcdefghijklmnopqrstuv";
$matches = array();
preg_match("/ghi/", $str, $matches, PREG_OFFSET_CAPTURE, 0);
print_r($matches);
will output
Array
(
[0] => Array
(
[0] => ghi
[1] => 6
)
)