Skip to content

Instantly share code, notes, and snippets.

@narita1980
Last active December 15, 2015 17:49
Show Gist options
  • Save narita1980/5298881 to your computer and use it in GitHub Desktop.
Save narita1980/5298881 to your computer and use it in GitHub Desktop.
preg_match_allを使う際の注意点 ※同じ不一致の場合でも戻り値が異なる
<?php
preg_match_all('/hoge/', 'This is a test.', $matches);
var_dump($matches);
preg_match_all('/hoge/', 'This is a test.', $matches, PREG_SET_ORDER);
var_dump($matches);
/*****
Output:
array(1) {
[0]=>
array(0) {
}
}
array(0) {
}
*****/
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment