This is my code :
<?php
$merchant_0 = array('id' => '22',
'merchant_id' => '3',
'price' => '199.95'
);
$merchant_1 = array('id' => '32',
'merchant_id' => '3',
'price' => '205.95'
);
$merchant_2 = array('id' => '65',
'merchant_id' => '5',
'price' => '212.95'
);
$merchant_3 = array('id' => '41',
'merchant_id' => '5',
'price' => '212.95'
);
$merchant_4 = array('id' => '67',
'merchant_id' => '5',
'price' => '212.95'
);
$merchant_5 = array('id' => '87',
'merchant_id' => '7',
'price' => '212.95'
);
$merchant_6 = array('id' => '33',
'merchant_id' => '8',
'price' => '212.95'
);
$merchant_7 = array('id' => '19',
'merchant_id' => '9',
'price' => '212.95'
);
$merchant_8 = array('id' => '9',
'merchant_id' => '10',
'price' => '212.95'
);
$array = array($merchant_0,$merchant_1,$merchant_2,$merchant_3,$merchant_4,$merchant_5,$merchant_6,$merchant_7,$merchant_8);
print_r(array_values($array));
echo '<BR>--<BR>';
for ($i=0, $n=sizeof($array); $i<$n; $i++) {
echo $array[$i][merchant_id];
$merchants[] .= $array[$i][merchant_id];
}
echo '<BR>--<BR>';
print_r(array_values($merchants));
$merchants_unique = array_unique($merchants);
echo '<BR>--<BR>';
print_r(array_values($merchants_unique));
echo '<BR><BR>Begin<BR>';
for ($i=0, $n=sizeof($merchants_unique); $i<$n; $i++) {
echo '* ';
echo $merchants_unique[$i];
echo ' *<BR>';
}
echo 'End<BR>';
?>
I'm Getting This as a result:
Array ( [0] => Array ( [id] => 22 [merchant_id] => 3 [price] => 199.95 ) [1] => Array ( [id] => 32 [merchant_id] => 3 [price] => 205.95 ) [2] => Array ( [id] => 65 [merchant_id] => 5 [price] => 212.95 ) [3] => Array ( [id] => 41 [merchant_id] => 5 [price] => 212.95 ) [4] => Array ( [id] => 67 [merchant_id] => 5 [price] => 212.95 ) [5] => Array ( [id] => 87 [merchant_id] => 7 [price] => 212.95 ) [6] => Array ( [id] => 33 [merchant_id] => 8 [price] => 212.95 ) [7] => Array ( [id] => 19 [merchant_id] => 9 [price] => 212.95 ) [8] => Array ( [id] => 9 [merchant_id] => 10 [price] => 212.95 ) )
3355578910
Array ( [0] => 3 [1] => 3 [2] => 5 [3] => 5 [4] => 5 [5] => 7 [6] => 8 [7] => 9 [8] => 10 )
Array ( [0] => 3 [1] => 5 [2] => 7 [3] => 8 [4] => 9 [5] => 10 )
Begin
3
5
7
End
What is happening inbetween the "Begin' and 'End' ?????
I want it to look like :
Begin
3
5
7
8
9
10
End
I thought it should, but I can't figure out what is going on!
Thanks in advance!
~tim