- var_dump: documentation ( source)
- preg_match: documentation ( source)
<?php
$array = [
'aaa 3',
'bbb 15',
'ccccc 3A',
'dddd 2412',
'eee fff 15',
'ggg 612',
'hhh iiiii 23B',
];
$regex = '#(?<word>\D+)\s(?<number>.+)#';
$results = [];
foreach ($array as $line) {
preg_match($regex, $line, $matches);
$results[$matches['word']] = $matches['number'];
}
var_dump($results);