tags:

views:

19

answers:

1

I have two arrays with two sets of values in ($a[] and $b[]) I want to do something like the following:

$a[0] - $b[0] $a[0] - $b[1]

$a[1] - $b[0] $a[1] - $b[1]

This will continue until the arrays reach the end. So i want a hyphen to seperate the two arrays, with the first array staying the same until the second array has looped through.

I am trying to get this in a dropdown with option value.

How could i achieve this? I never tried doing any loops with two varaibles like that before, I literally have no idea at all! Thankyou

+2  A: 

This would loop the second array ($b) for each value of the first array ($a).

foreach($a as $first) {
foreach($b as $second) {
echo $first . '-'. $second;
}
}
Scott