<?php
$strings = [
'iPhone 7 plus - space grey (New)',
'iPhone6 plus, brand new, (Used)',
'iPhone 5 ( black)',
];
var_export(preg_replace('~ ?[^ [:alnum:]].*~', '', $strings));
- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- array (
0 => 'iPhone 7 plus',
1 => 'iPhone6 plus',
2 => 'iPhone 5',
)
preferences:
64.99 ms | 406 KiB | 5 Q