You could likely loop through your array while using stristr:
foreach($arr as $item => $val) { 
    $res[] = stristr($item, 'product');
    $int[] = filter_var($item, FILTER_SANITIZE_NUMBER_INT);
}
print_r(array_filter($res)); // output keys with substring 'product'
print_r(array_filter($int)); // output integers from product key substring
This would allow you to collect any keys that contain the sub-string 'product'. From there you could also capture any integers associated with that key.
Output:
Array
(
    [1] => product1
    [2] => product4
    [3] => product12
)
Array
(
    [1] => 1
    [2] => 4
    [3] => 12
)