+ 2
How to get the count of the same string value from array in php?
4 Réponses
+ 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);
+ 2
Clarify that with example Ahmed Osama Elbadrawy
+ 1
Example
$arr = ('h','e','l','l','o');
How do I know how many times each letter of the array will repeat
0
mm