how can I combine this
5 4 3 2 1 1 (an array id)
3 3 2 1 3 2 (an array value)
and I want output is like this for array(value)
id value
5 - 3
4 - 3
3 - 2
2 - 1
1 - 3
1- 2
how can I combine this
5 4 3 2 1 1 (an array id)
3 3 2 1 3 2 (an array value)
and I want output is like this for array(value)
id value
5 - 3
4 - 3
3 - 2
2 - 1
1 - 3
1- 2
Try this:
$array = array(5=>3, 4=>3, 3=>2, 2=>3, 1=>2);
foreach($array as $key=>&$val){
$val = $key."-".$val;
}
echo "<pre>";
print_r($array);