cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
Hmm, maybe I'm not understanding your question, can you please post your code and spot the problem?
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
A foreach loop will work:
foreach($ab as $k => $v)
{
echo "$k - $v \n";
}
If you wan to group them in different arrays then use:
$keys = array();
$values = array();
foreach($ab as $k => $v)
{
$keys[] = $k;
$values[] = $v;
}
print_r($keys);
print_r($values);
Or better use array_keys() and array_values():
$ab = array('0'=>'10','1'=>'5','2'=>'8');
$ba = $ab;
asort($ba);
print_r(array_keys($ba));
print_r(array_values($ba));
Ok?
cereal
Veteran Poster
1,146 posts since Aug 2007
Reputation Points: 344
Solved Threads: 223
Skill Endorsements: 22
Question Answered as of 3 Months Ago by
cereal