The following example.
I have an array like this :
Array
(
[0] => vlakke lasflenzen PN6
[1] => vlakke lasflenzen PN10
[2] => vlak
I finally got my own solutin to work.
$names = array[
'vlakke lasflenzen PN6',
'vlakke lasflenzen PN10',
'vlakke lasflenzen PN16',
'vlakke lasflenzen PN25-40'
];
$name = [];
$parts = [];
foreach ($names as $name) {
$parts[] = array_filter(explode(' ', $name));
}
foreach ($parts[0] as $index => $part) {
$match = true;
foreach ($parts as $item) {
if ($item[$index] !== $part)
$match = false;
}
if ($match)
$name[] = ucfirst($part);
}
echo implode(' ', $name);
# Output : "Vlakke Lasflenzen"