I have a string which contains 5 digit numbers all beginning with 00 mixed in with other random characters. I am trying to extract all the 5 digit numbers and place them in an array ($array).
Here is my script. For some reason all I get returned is the first element "009875". Please could someone tell me how to get all matches in to the array
$string = "abcd kk 009875 kekeke 002345 kjhgers 009876";
if(ereg("00[0-9][0-9][0-9][0-9]",$string,$array)){
echo $array[0]."<br>".$array[1]."<br>".$array[2];
Thanks
Rob