Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have three array like below

Array
(
    [02/2013] => 2
    [03/2013] => 1
    [04/2013] => 5
    [05/2013] => 11
    [06/2013] => 1
    [07/2013] => 9
    [08/2013] => 3
)
Array
(
    [07/2013] => 99
    [08/2013] => 76
)
Array
(
    [02/2013] => 2
    [04/2013] => 2
    [06/2013] => 4
    [07/2013] => 3
    [08/2013] => 5
)

I want to find the maximum count array index print which is defined below.There will be three use case like below.

If count of first array index is greater print "first array has maximum index"

If count of second array index is greater print "second array has maximum index"

If count of third array index is greater print "third array has maximum index"

After Edit :

actually what I want that we need to same array index for all three if array index is not exits then it will create and put it value 0 by default.

share|improve this question
A simple loop with array_sum() would do the job. Now try it, if you get stuck read the manual, if you weren't able to then search for other questions. Lastly if you fail come here again. – HamZa Aug 9 at 7:12
not want sum of array we have count($array) – sonusindhu Aug 9 at 7:13
lol then you know what to do. So what's stopping you :-) ? – HamZa Aug 9 at 7:14
compare count($array1),count($array2),count($array3) – PravinS Aug 9 at 7:14
Pass three array counts to an array, then get highest using max() function or reverse sort the array and get the first element. – balajimca Aug 9 at 7:20
show 3 more comments

put on hold as off-topic by HamZa, vascowhite, w00, shiplu.mokadd.im, Dave Chen Aug 9 at 7:14

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist" – HamZa, vascowhite, w00, shiplu.mokadd.im, Dave Chen
If this question can be reworded to fit the rules in the help center, please edit the question.

Browse other questions tagged or ask your own question.