<?php $data = [ 'Light Blue1', 'Blue2', 'Blue1', 'Black3', 'Black12', 'Black2' ]; natsort($data); $result = []; foreach ($data as $value) { $result[rtrim($value, '0..9')] = $value; } var_export(array_values($result));
You have javascript disabled. You will not be able to edit any code.