[Solved] Convert data to array, and find count based on filters


write the code like this

$log = "08/02/14 | Red | Wood
08/03/14 | Red | Steel
08/04/14 | Blue | Wood
08/05/14 | Red | Steel
08/05/14 | Red | Wood
08/05/14 | Red | Steel
08/05/14 | Blue | Steel
08/06/14 | Blue | Wood";

$log = explode("\n", trim($log));   
// Seperate each part in each logline
$dateFreq = array();
$colorFreq = array();
$MaterialFreq = array();
foreach ($log as $line) {
    $lineArr = explode("|", $line);
    $date = trim($lineArr[0]);
    $color = trim($lineArr[1]);
    $material = trim($lineArr[2]);
    if ($date >= '08/04/14' && $date <= '08/05/14') {  
        if (isset($dateFreq[$date])) {
            $dateFreq[$date] = $dateFreq[$date] + 1;
        } else {
            $dateFreq[$date] = 1;
        }
        if (isset($colorFreq[$color])) {
            $colorFreq[$color] = $colorFreq[$color] + 1;
        } else {
            $colorFreq[$color] = 1;
        }
        if (isset($MaterialFreq[$material])) {
            $MaterialFreq[$material] = $MaterialFreq[$material] + 1;
        } else {
            $MaterialFreq[$material] = 1;
        }
    }
}
echo "<h2>Date Count:</h2>\n";
foreach ($dateFreq as $date => $freq) {
    echo $date, " - ", $freq, "\n";
}

echo "<h2>Color Count:</h2>\n";
foreach ($colorFreq as $color => $freq) {
    echo $color, " - ", $freq, "\n";
}

echo "<h2>Material Count:</h2>\n";
foreach ($MaterialFreq as $material => $freq) {
    echo $material, " - ", $freq, "\n";
}

solved Convert data to array, and find count based on filters