Reply to Re: Get unique combos from arrays

Your name:

Reply:


Posted by ZeldorBlat on 10/09/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";
}
}
}

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация