Reputation:
I've an associative array:
Array ( [1] => 1 [2] => 0 )
array will always contain only two.
The key is user_id
and value is status
.
I applied ksort()
to the array, because I wanted lower user_id first in the array.
Now I want to grab key and value for each, (but I never know what key=user_id is):
$key_1
$value_1
$key_2
$value_2
Upvotes: 0
Views: 105
Reputation: 2736
reset($array);
list($key_1, $value_1) = each($array);
list($key_2, $value_2) = each($array);
Upvotes: 0