PHP getting the output of the command "mailq" to an array

view full story

http://stackoverflow.com – I'm having trouble with the executing the command mailq and turning it's output into values in a multidimensional array. $results = array(); exec('/usr/bin/mailq', $mailQresult); foreach ($mailQresult as $key => $mailqLine) { $res = preg_match('/^([A-Z0-9]{1,20})\s+([1-9][0-9]*)\s+((Mon|Tue|Wed|Thu|Fri|Sat|Sun)\s+[A-Za-z]{3}\s+[0-9]{2}\s+[0-9]{2}\:[0-9]{2}\:[0-9]{2})\s*$/', $mailqLine, $matches); if ($res) { // Insert message ID and other data into the object. // It will be competed afterwards. $mailqArray = array( 'id' => $m (HowTos)