|
Posted by ZeldorBlat on 09/29/45 12:00
On Jan 16, 12:04 pm, sberry <hacker.steven...@gmail.com> wrote:
> I have three arrays... for instance
>
> $a = array('big', 'small', 'medium');
> $b = array('old', 'new');
> $c = array('blue', 'green');
>
> I want to take those and end up with all of the combinations they
> create like the following
> 'big', 'old', 'blue'
> 'small', 'old', 'blue'
> 'medium', 'old', 'blue'
> 'big', 'old', 'green'
> 'small', 'old', 'green'
> 'medium', 'small', 'green'
> 'big', 'new', 'blue'
> 'small', 'new', 'blue'
> 'medium', 'new', 'blue'
> 'big', 'new', 'green'
> 'small', 'new', 'green'
> 'medium', 'new', 'green'
>
> Is there an easy way to do this mapping?
foreach($a as $va) {
foreach($b as $vb) {
foreach($c as $vc) {
echo "'$va', '$vb', '$vc'\n";
}
}
}
Navigation:
[Reply to this message]
|