- var_export: documentation ( source)
- preg_split: documentation ( source)
<?php
$array = [
'Some Text',
'Some Other Text (+£14.20)',
'Foo',
'Text Text (+£26.88)',
'Another One (+£68.04)',
];
$result = [];
foreach ($array as $v) {
$a = preg_split('/ \(\+£([^)]+)\)/', $v, 2, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
$result[$a[0]] = (float) ($a[1] ?? 0);
}
var_export($result);