mardi 10 septembre 2019

Only variables should be passed by reference - Laravel 5

When I did

return asort(array_count_values(Visitor::all()->pluck('device')->toArray()));

I kept getting

Only variables should be passed by reference

This is an array

array_count_values(Visitor::all()->pluck('device')->toArray())

It returns

{
    iPhone: 202,
    Windows NT 6.1: 2428,
    Windows NT 10.0: 2588,
    Macintosh: 1397,
    iPad: 12,
    Windows NT 6.2: 50,
    Windows NT 6.3: 90,
    X11: 442,
    compatible: 1813,
    Windows NT 5.1: 97,
    Linux: 227,
    Windows: 86,
    TweetmemeBot/4.0: 8,
    ) { :: 14,
    Windows NT 6.0: 7,
    User-Agent,Mozilla/5.0 : 1,
    KHTML, like Gecko: 6,
    Unknown: 11,
    Android: 1,
    Android 7.1.1: 1,
    Android 7.1.2: 2,
    Windows NT x.y: 2,
    Windows NT 6.1) AppleWebKit/537.36 : 7,
    Windows NT 5.0: 1,
    Windows NT 8.0: 1,
    web crawler :: robots.txt exclude elefent: 1,
    Windows NT: 1,
    Linux 4.4.0-116-generic: 1
}

I want to sort them desc base on array_count_values.

Why do I get that error ?



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2ZXgobs
via IFTTT

Aucun commentaire:

Enregistrer un commentaire