Road Possible options
1 1, 2 or 3
2 1, 2 or 3
3 1, 2 or 3
Does anyone know how I would tell php to pull all the possible combinations out if road = $road and Possible options = $pso?
Would it be a case of using a series of for loops inside each other?
Quite stumped on this one as I've never seen or done anything like this before.
Thanks in advance if you can help
Pulling out all possible combinations
Moderator: General Moderators
-
freelance84
- Forum Newbie
- Posts: 8
- Joined: Thu Apr 29, 2010 6:32 pm
-
freelance84
- Forum Newbie
- Posts: 8
- Joined: Thu Apr 29, 2010 6:32 pm
Re: Pulling out all possible combinations
I can't believe it but i think i've done it:
$count1 = count array $pso1
$count2 = count array $pso2
$count3 = count array $pso3
$count1 = count array $pso1
$count2 = count array $pso2
$count3 = count array $pso3
Code: Select all
for($a = 1 ; $a < $count1 ; ++$a)
{
for($b = 1 ; $b <$count2;++$b)
{
for($c = 1 ; $c < $count3 ; ++$c)
{
echo $pso[$a].$pso[$b].$pso[$c] "<br />";
}
}
}