Change Array key to value

hi, i want to change an array's key to its values.
the array is like this:
<php
Array ( [0] => category_name: [1] => c1 [2] => types: [3] => t1 )
?>
i want to make the same array's values as key, like below using some array functions or some other functions please help
<?php
Array ( [category_name:] =>c1[types:]=>t1 )
?>

You both had introduced a relatively well known performance no no in your codes.
You should never have a function call in your loops. for($i=0,$limit=count($arr); $i < $limit; ++$i)while($intIndex <= count($arrInput)) In both pieces of code, move the count() function calls outside of the loop initialization.
This is evaluated on every iteration of the loop. You can verify this with a code trace in xdebug.

-hielo

You can also remove the is_array check from your code by specifying the the parameter passed is of type array. Unfortunately besides object types and the array type there are no other function argument types you can use.

You can also remove the is_array check from your code by specifying the the parameter passed is of type array. Unfortunately besides object types and the array type there are no other function argument types you can use.