Last active
December 15, 2015 17:49
-
-
Save narita1980/5298881 to your computer and use it in GitHub Desktop.
preg_match_allを使う際の注意点
※同じ不一致の場合でも戻り値が異なる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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