- preg_match_all: documentation ( source)
<?php
$str = 'STRATFORDOLD 074808972499';
preg_match_all( '/^(.*?)\s+(?:^|\D)(\d{12})(?=\D|$)/m', $str, $matches);
$items = array();
foreach( $matches[2] as $k => $upc) {
$items[$upc] = $matches[1][$k];
}
echo $items['987654321098']; // OTHER NAME