[php]
$numbers = array(
‘one’ => ‘one’
,’two’ => ‘two’
,’three’ => ‘three’
,’four’ => ‘four’
,’five’ => ‘five’
,’six’ => ‘six’
,’seven’ => ‘seven’
,’eight’ => ‘eight’
,’nine’ => ‘nine’
,’ten’ => ‘ten’
);
foreach($numbers as $num_key=>$num_val){
$array_keys[$num_key] =$num_key;
}
//RESULT
Array
(
[one] => one
[two] => two
[three] => three
[four] => four
[five] => five
[six] => six
[seven] => seven
[eight] => eight
[nine] => nine
[ten] => ten
)
[/php]
[php]
array(0,1,2,3,3,4,5,5,7,8,7,7)
foreach($numbers as $num_key=>$num_val){
$array_keys[$num_key] =$num_key;
}
//RESULT
Array
(
[0] => 0
[1] => 1
[2] => 2
[3] => 3
[4] => 4
[5] => 5
[6] => 6
[7] => 7
[8] => 8
[9] => 9
[10] => 10
[11] => 11
)
[/php]