Ok im stumped, I wrote some code that does a loop and reads a text file parsing that text file into $dh, once the loop is done i can use a print_r to see whats in my array, which works fine but for the life of me i cannot figure out how to write the proper foreach statement, im still new so this multi arrays are giving me a headache 🙁
<?php
$fh = fopen("somefile.txt", "r");
while (!feof($fh)) {
$line = fgets($fh, 4096);
$arr = preg_split("/[\s,]+/", $line,8);//split file into parts
$domain = $arr[2]; //Domain Location in Array
$url = $arr[2].$arr[3]; //Domain and location combind
$referer = $arr[6];
$browser = $arr[7];
$hits["$url"]++;
$dh["$domain"]++;
$dh["$url"]['hits']++;
$dh["$url"]['bytes'] += $bytes;
$dh["$url"]['referers'][$referer]++;
}
fclose($fh);
print("<pre>"); print_r($dh); print("</pre>"); // this works fine
now is where im stuck with creating a nice foreach loop that prints out the values from the variable $dh such as domain,url,hits,browser,refere.
ideas? suggestions? pointers to good articles on multi arrays?
Gate