HardCoreMore Posted January 28, 2011 Share Posted January 28, 2011 Hi all, Why i can't get all the a's and their indexes. This is the script: $s1 = "a a vvvaaa sdfdsaaa ffss afdsaaaaa"; $t = preg_match( '/(a*)/i', $s1, $m, PREG_OFFSET_CAPTURE ); echo '<pre>'; print_r( $m ); echo '</pre>'; This is what i get: Array ( [0] => Array ( [0] => a [1] => 0 ) [1] => Array ( [0] => a [1] => 0 ) ) I am getting just the first a at index 0 twice Quote Link to comment Share on other sites More sharing options...
trq Posted January 28, 2011 Share Posted January 28, 2011 preg_match_all. Quote Link to comment Share on other sites More sharing options...
HardCoreMore Posted January 28, 2011 Author Share Posted January 28, 2011 hahahahah thanks preg_match_all() hahahha thanks i would never guessed it thank you Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.