I am a designer working on a code igniter project and I am stuck on this problem!
I have this array
Array
(
[Science] => 7
[War] => 5
[Mystery] => 2
[Preview Only] => 2
[Conspiracy,News ] => 2
[Drugs,Educational,Lifestyle,Society] => 1
[Educational,Nature,Science,Space] => 1
[Religion,Society] => 1
[Music] => 1
[Movies,Music] => 1
[Lifestyle] => 1
[Countries,Educational,History,War] => 1
[Educational,Society] => 1
[Science,Space,Technology] => 1
[Economics,Educational,Lifestyle,Society] => 1
[Society] => 1
[Biology,Conference,Educational] => 1
[Human Rights,Society] => 1
[Art and Artists,Biographies,Music] => 1
[Biology,Educational,Science] => 1
[Activist,Biology,Science,Society] => 1
[Countries,Drugs,War] => 1
[Drugs,War] => 1
[Technology,War] => 1
[History,War] => 1
[Biology,Educational,Environment,Nature,Science] => 1
[Science,Technology] => 1
[Educational,Science,Space] => 1
[Educational,History,Human Rights,War] => 1
[Environment] => 1
[Biographies] => 1
[Evolution,Science] => 1
[Art and Artists] => 1
)
As you can see there it is already ordered by a number. What I would like to achieve is removing any duplicate categories from the array and adding a +1 to each category, leaving me with this result:
Array
(
[Science] => 14
[War] => 11
[Mystery] => 2
[Preview Only] => 2
[Conspiracy] => 2
[Society] => 4
[Nature] => 1
[space] => 1
[Religion] => 1
[Music] => 2
[Movies] => 1
[Lifestyle] => 1
[Countries] => 1
[Educational] => 12
[Space] => 1
[Lifestyle] => 1
[Society] => 3
[Biology] => 3
[Economics] => 1
[Science] => 1
[Activist] => 1
[Countries] => 1
[Drugs] => 3
[Technology] => 2
[History] => 1
[Biology] => 1
[Technology] => 1
[Space] => 1
[History] => 1
[Human Rights] =>
[Environment] => 1
[Biographies] => 2
[Evolution] => 1
[Art and Artists] => 1
)
The examples don't perfectly match but you can see what I am trying to achieve. THANKS EVERYONE!!!