Hi all,
I am trying to create a function that will generate and return an array of shoe sizes. So far I have two loops that are required to create the sizes due to the fact that the sizes are 1/2 sizes from 6 - 11.5 and full sizes from 12 to 20. The code I have nearly works until I tried to put it in a function and get the two arrays to merge at the end. I think the issue is with array_merge thinking the keys are part of an indexed array because they are numbers. I will stop rambling and post what I have so far.
[php]function generate_sizes($half_start, $half_stop, $full_start, $full_stop) {
for($i=$half_start; $i<=$half_stop; $i=$i+.5) {
$first[] = $i;
}
$first_form = str_replace(".", “_”, $first);
$first = array_combine($first, $first_form);
for($i = $full_start; $i <= $full_stop; $i++) {
$second[] = $i;
}
$second = array_combine($second, $second);
$size = array_merge($first, $second);
return $size;
}[/php]
P.S. the str_replace part in the first array is to avoid having an html input named 7.5. name will change to 7_5 instead.