我有以下 PHP 代码:
$age = array_merge($age,array(get_user_meta($comment->user_id, 'wsl_user_age', true)));
这会产生:
Array
(
[0] => 26
[1] =>
[2] => 18
[3] => 28
[4] => 22
[5] => 21
[6] => 26
[7] =>
[8] =>
[9] =>
[10] =>
[11] =>
[12] =>
[13] =>
[14] =>
[15] =>
[16] =>
[17] =>
[18] =>
[19] =>
[20] =>
)
我想要的是 26 18 等作为键。并重视它重复的次数,本质上是重复计数。
我试过:
$age = array_merge($age,array(get_user_meta($comment->user_id, 'wsl_user_age', true)=> ""))
但这产生了绝对的废话。
我应该尝试什么?