Mega Code Archive

 
Categories / Php / Strings
 

Finding the nth Occurrence of a Match

<?php  preg_match("/\d/", "1 and 2 and 3 and 4", $matches);  echo "Value: " . $matches[0][2] . "\n";  ?>