I know that you can count the number of lines with
$record = file($data_file);
rsort($record);
$total_lines = count($record);
echo $total_lines;
Is there a way to count only lines with certain words and get a total?
for example I have a flat file with
|~|opel|~|red|~|doors 4|~|
|~|opel|~|red|~|doors 2|~|
|~|opel|~|blue|~|doors 4|~|
|~|opel|~|white|~|doors 2|~|
|~|opel|~|red|~|doors 4|~|
|~|opel|~|white|~|doors 4|~|
What I'm trying to do is get a total of only eg
- blue
- or red and white
- or blue and white
Any help would be great.