Alternate to array_column()

前端 未结 6 1457
我寻月下人不归
我寻月下人不归 2020-12-02 18:57

I have used array_column() in a project, and after uploading I found out that only PHP 5.5 or above support this function, and I think the hosting I use don\'t

6条回答
  •  情书的邮戳
    2020-12-02 19:36

    Using array_map() instead, something like:

    array_count_values(
        array_map(
            function($value) use ($idForBar) {
                return $value[$idForBar];
            },
            json_decode(
                json_encode($queryResultArray),
                true
            )
        )
    );
    

提交回复
热议问题