International PHP Conference Munich 2025

Voting

: max(three, three)?
(Example: nine)

The Note You're Voting On

chrysb at gmail dot com
16 years ago
If you are looking for a way to count the total number of times a specific value appears in array, use this function:

<?php
function array_value_count ($match, $array)
{
$count = 0;

foreach (
$array as $key => $value)
{
if (
$value == $match)
{
$count++;
}
}

return
$count;
}
?>

This should really be a native function of PHP.

<< Back to user notes page

To Top