So say HP (15), Epson (5), etc. This is how I'm currently thinking of going about doing this but there is probably a much more effective way to do this then how I'm going about it below. Even in my example I'm not sure how to do an incrementing variable variable. Still fairly new to php so any help is greatly appreciated! Also there is a lot of manufacturers so testing if it's one of each wouldn't work either.
Let me know if I'm being unclear about my problem.
Code: Select all
// Check if current manufacturer has already been found in previous item
If ($manufacturer = $existing_manufacturer1){
$existing_manufacturer1_count += 1
} elseif ($manufacturer = $existing_manufacturer2){
$existing_manufacturer2_count += 1
} else {
//if not found in a previous item then assign it to an incrementing variable
$manufacturer = $existing_manufacturer3
}
echo $existing_manufacturer1 . $existing_manufacturer1_count (etc etc);