<?php $array = [ "QLogic BCM57810 10 Gigabit Ethernet (NDIS VBD Client)", "Microsoft Network Adapter Multiplexor Driver", "Microsoft Network Adapter Multiplexor Driver Simplified", "QLogic BCM57810 10 Gigabit Ethernet (NDIS VBD Client) #75", "QLogic BCM57810 10 Gigabit Ethernet (NDIS VBD Client)", "Microsoft Network Adapter Multiplexor Driver", "QLogic BCM57810 10 Gigabit Ethernet (NDIS VBD Client)", "QLogic BCM57810 10 Gigabit Ethernet (NDIS VBD Client)", ]; $lookup = []; foreach (array_count_values($array) as $value => $count) { if ($count > 1) { $lookup[$value] = 0; } } foreach ($array as &$value) { $value .= (isset($lookup[$value]) ? "_" . ++$lookup[$value] : ''); } var_export($array);
You have javascript disabled. You will not be able to edit any code.