PHPのドキュメントわかりづらい
http://jp.php.net/manual/ja/function.preg-match.php・1の例
$subject = "abcdef"; $pattern = '/^def/'; preg_match($pattern, $subject, $matches, PREG_OFFSET_CAPTURE, 3); print_r($matches);
こちらが
Array
(
)
になり、
・2の例
$subject = "abcdef"; $pattern = '/^def/'; preg_match($pattern, substr($subject,3), $matches, PREG_OFFSET_CAPTURE); print_r($matches);
が
Array ( [0] => Array ( [0] => def [1] => 0 ) )
な理由。
abcdefは
|a|b|c|d|e|f|
|0|1|2|3|4|5|