remove the integer index value of the array.
$array1=array(); $array = array(0 => first,first => second,1 => second,second => second,2 => third,third => third,3 => forth,forth => v,4 => fifth,fifth => fifth); foreach ($array as $key=>$value){ if(gettype($key)=='integer'){ unset($key); unset($value); }else{ $array1[$key]=$value; } } print_r($array1);
out is as follows.
Array
([first] => second [second] => second [third] => third [forward] => v [fifth] => fifth)
source share