3 years ago

count array for specific value - laravel 5.2

Posted 3 years ago by shafiqkr

I got result from database in laravel DB::select.

Now i want to find count of different records in the array.

To find rentals , I have type = 1 so i tried this

$rentals = array_only($arr, ['type', 1]);

This give me wrong result.

To find commercial in rentals i am using this code

  $rentals = array_only($arr, ['type', 1]['commercial',1]);

This also not working. How i can do it?

Please sign in or create an account to participate in this conversation.