PHP - count specific array values

前端 未结 10 1557
野的像风
野的像风 2020-12-02 18:00

How can I count the number of element inside an array with value equals a constant? example,

$myArray = array(\"Kyle\",\"Ben\",\"Sue\",\"Phil\",\"Ben\",\"Mar         


        
10条回答
  •  渐次进展
    2020-12-02 18:52

    Use array_count_values() function . Check this link http://php.net/manual/en/function.array-count-values.php

提交回复
热议问题