Example of string $line - 2005 has 0 calls (max unlimited) in 'ringall' strategy (0s holdtime), W:0, C:0, A:0, SL:0.0% within 0s foreach ($line as $myline) { if(strstr($myline,"strategy")) { preg_match("/^([0-9]+)[\s]+has[\s]+([0-9]+)[\s]+calls.*$/", $myline, $myMatches); $qinfo[$index][0]=$myMatches[1]; $qinfo[$index][1]=$myMatches[2]; } $myMatches = array(); $index++; }