Please tell me how you can delete the values in the array leaving the keys, without any cycles.
For example, there is such an array:
$array = [ 'one' => 1, 'two' => 2, ... ]; Convert it to this:
$array = [ 'one', 'two', ... ]; You can use the function array_keys($array)
array_keys($array) Get from the array, only qiq: array_map
$array = [ 'one' => 1, 'two' => 2 ]; $myarr = array_map(create_function('$n', 'return null;'), $array); $array = [ 'one', 'two' ]; print_r($array); $array = [ 'one', 'two' ]; print_r($array); returns Array ( [0] => one [1] => two ) because it is the same. There are no arrays without keys in nature. ideone.com/jEiMyR - MikeSource: https://ru.stackoverflow.com/questions/625119/
All Articles
echo json_encode(array_keys($array));- vp_artharray_fill_keys(array_flip($array),'');- Ans