Page 1 of 1

How to find out how many similar digit.

Posted: Sun Sep 13, 2009 5:39 am
by stimson
Hello,

i need to find out how many similar digit that given.

Example given digit: 5666 (must echo : 3 similar digit)
Example given digit: 8866 (must echo : 2 pair of similar digit)
Example given digit: 2336 (must echo : 1 pair of similar digit)
Example given digit: 3576 (must echo : 0 pair of similar digit)

what function i can use to get the echo?

Re: How to find out how many similar digit.

Posted: Sun Sep 13, 2009 6:20 am
by Darhazer
First split it to an array, then use array_count_values

Re: How to find out how many similar digit.

Posted: Tue Sep 15, 2009 12:08 am
by stimson
Thanks alot Darhazer!