Hello everybody,
I need some help to do a script:
I need to count how many time each specifics words appear in a specific file:
Example file content (.menu):
2::SERVICES::CFHT Archive (CADC)::http://cadcwww.dao.nrc.ca/cfht/
2::NEW::JCMT Archive (CADC)::http://cadcwww.dao.nrc.ca/jcmt/
2::TEST::The SIMBAD database::http://simbad.u-strasbg.fr/
2::TEST::The SIMBAD database::http://simbad.u-strasbg.fr/
2::TEST::BLA bla::http://bla.com
2::SERVICES::The Vizier catalogs, CDS::http://vizier.u-strasbg.fr/
I need to count how many time does SERVICES, NEW, TEST appaear in the .menu file:
Result should be:
SERVICES = 2
NEW = 1
TEST = 3
// Extract each line content
$filename= (".menu");
$menu=file($filename);
foreach ($menu as $content) {
$menu_content = explode('::', $content);
}
This code extract each line to display a menu but I need to count the $menu_content[1] in the whole file to know if there one or more menu with the same data(SERVICES, NEW, TEST) to display an arrow if ">= 1".
Thanks in advance
Cedric