1

I've got an array like this one:

arrayname[1] = "jacob";
arrayname[2] = "peter";
arrayname[3] = "jacob";
arrayname[4] = "nicholas";

I want to remove the double jacob so it will be like

arrayname[1] = "jacob";
arrayname[2] = "peter";
arrayname[3] = "nicholas";

How do I do that?

2
  • @fayer, if you indent your code with at least four spaces it will format properly. I fixed this question, but for future reference. Commented Dec 4, 2009 at 1:57
  • Questions like this can easily be answered by just browsing the PHP Array Documentation and reading the function names. Commented Dec 4, 2009 at 3:03

2 Answers 2

9

array_unique()

Sign up to request clarification or add additional context in comments.

Comments

2
$array = array_unique($array);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.