What is the difference between
foreach ($my_array as $my_value) {
}
And:
foreach ($my_array as &$my_value) {
}
I only use references when i have to read csv files to know what is the delimitier. Just take the first line:
$handle = fopen($file, "r");
$firstLine = fgets($handle);
fclose($handle);
Then with this possible delimitiers
$delimiters = array(';' => 0,',' => 0,"\t" => 0,"|" => 0);
Count by reference what is the most used
foreach ($delimiters as $delimiter => &$count) {
$count = count(str_getcsv($firstLine, $delimiter));
}
$delimiter = array_search(max($delimiters), $delimiters);