Convert an associative array to a simple array of its values in php

I would like to convert the array:

Array ( 
[category] => category 
[post_tag] => post_tag 
[nav_menu] => nav_menu 
[link_category] => link_category 
[post_format] => post_format 
)

to

array(category, post_tag, nav_menu, link_category, post_format)

I tried

$myarray = 'array('. implode(', ',get_taxonomies('','names')) .')';

which echos out:

array(category, post_tag, nav_menu, link_category, post_format)

So I can do

echo $myarray;
echo 'array(category, post_tag, nav_menu, link_category, post_format)';

and it prints the exact same thing.

...but I can't use $myarray in a function in place of the manually entered array because the function doesn't see it as array or something.

What am I missing here?


只需使用array_values函数:

$array = array_values($array);

你应该使用array_values() 函数

链接地址: http://www.djcxy.com/p/57332.html

上一篇: Facebook,Gmail如何发送实时通知?

下一篇: 在php中将关联数组转换为其值的简单数组