Jump to content

Check if value in array is unique, and change all duplicates if not


johnsmith153

Recommended Posts

I need to CREATE unique values for all matching arrays,

 

so, if I start with:

 

$array[0]="Jim Smith";

$array[1]="Dave Brown";

$array[2]="Dennis Brown";

$array[3]="Steve Smith";

 

I need to return the surname, but if not unique, I need to append the first letter of name, then keep checking to ensure unique

 

So I would then end with:

 

$array[0]="J.Smith";

$array[1]="Da.Brown";

$array[2]="De.Brown";

$array[3]="S.Smith";

 

Any ideas?

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.