4

I am using array_count_values and I want to pull any key that has a value greater than > 4 and put in a new array. Is there a way to do this?

1
  • 1
    post your code. How is array_count_values connected to rest of your task? Commented Jan 13, 2011 at 11:53

2 Answers 2

3
foreach(array_count_values($the_array) as $key=>$value){
    if ($value > 4){
        echo $key;
    }
}
Sign up to request clarification or add additional context in comments.

1 Comment

This worked perfect I forgot about being able to do $key=>$value.
1

using the array_filter() function might be a good place to start.

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.