We will use two PHP functions for this. First,
array_keys($array)
to get the keys of the array, and second, implode($glue, $array)
to join the keys.Here's an example:
$arr = array('one' => 1, 'two' => 2, 'three' => 3);
$keys = array_keys($arr);
$str = implode(' ', $keys);
echo $str;
The result will be 'one two three'.
No comments:
Post a Comment