+ 2

How to get the count of the same string value from array in php?

20th Nov 2020, 4:52 PM
Ahmed Osama Elbadrawy
Ahmed Osama Elbadrawy - avatar
4 odpowiedzi
+ 4
So far I have understood is that, you need to count the number of occurrences of a certain value in an array. If I'm correct, then the answer is Suppose I want to check for "abc".., and there is an array named arr var string = "abc"; var count=0; for(var i=0; i<arr.length; i++){ if(arr[i] == string) count++; } console.log(count);
20th Nov 2020, 5:04 PM
Charitra
Charitra - avatar
+ 2
Clarify that with example Ahmed Osama Elbadrawy
20th Nov 2020, 4:55 PM
Ananiya Jemberu
Ananiya Jemberu - avatar
+ 1
Example $arr = ('h','e','l','l','o'); How do I know how many times each letter of the array will repeat
20th Nov 2020, 5:00 PM
Ahmed Osama Elbadrawy
Ahmed Osama Elbadrawy - avatar
0
mm
30th Nov 2020, 12:51 PM
mehdi-shah