3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'Some Text', 'Some Other Text (+£14.20)', 'Foo', 'Text Text (+£26.88)', 'Another One (+£68.04)', ]; $result = []; foreach ($array as $v) { sscanf($v . ' (+£0)', '%[^(](+£%f)', $item, $price); $result[rtrim($item)] = $price; } var_export($result);

preferences:
25.15 ms | 406 KiB | 5 Q