I have this array:
array('Volvo', 'BMW', 'Toyota', 'Kijang');
And I want results like this
"Volvo","BMW","Toyota","Kijang"
"BMW","Volvo","Toyota","Kijang"
"Toyota","Volvo","BMW","Kijang"
"Kijang","Toyota","Volvo","BMW"
and here's my code :
$products = array('Volvo', 'BMW', 'Toyota', 'Kijang');
$rows = count($products);
for ($i = 0; $i < $rows; $i++) {
echo $products[$i] . '<br>';
}
but, unfortunately I missed 3 results :
"BMW","Volvo","Toyota","Kijang"
"Toyota","Volvo","BMW","Kijang"
"Kijang","Toyota","Volvo","BMW"
how to get that missed combination and perfectly works for different array length?