I have a array in php
array(100,125,135);
I would like to know How I can get all combinations like in the below EG ?
Eg:100=>125,100=>135,125=>100,125=>135,135=>100,135=>125
I Tried something like this
$selected_items = array(100,125,135);
$total = count($selected_items);
$combination = array();
$newcom=0;
for($i=0;$i<$total;$i++){
if($newcom <= $total-1) $newcom = $newcom-1;
echo $newcom."-----";
$combination[$i] = array($selected_items[$i]=> $selected_items[$newcom]);
$newcom = $i+1;
}
But this is not working to get all combinations
Please help me.