Code: Select all
// variables declared here so accessible outside function scope
$arr_hour_regular = array();
$arr_hour_overtime = array();
// goes through each hour item and splits it into overtime and regular, then pushes them into their resp. arrays
function splitHours($hour_item, $hour_key, $delim) {
$arr_hour_splitted = explode ($delim, $hour_item);
array_push ($arr_hour_regular, $arr_hour_splitted[0]);
//$arr_hour_overtime[] = $arr_hour_splitted[1];
}
array_walk ($arr_hours, "splitHours", "/");
print_r ($arr_hour_regular);Array ( )
I can print $arr_hour_splitted inside the function and it displays what it's supposed to,
so it does go through the array_walk function just fine. But why is it not pushing the
the strings into the new array?