Laravel / Php array countable issue

  laravel, laravel-8, php

COUNT() function doesn’t work on PHP Version 7.4.13 – Laravel 8

$img_arr= $request->input('imgs');

$img_arr input request is used to get a data array from a form.

each request has more than 2 indexes count($img_arr) isn’t work to identify the total indexes of the array.

hard coding the count() is working like

        $array = ['car','bus','flight'];
        //output = 3

following isn’t working on new version of php which was worked in pervious version.

    $img_arr= $request->input('imgs');
    // $array = ['car','bus','flight'];

Source: Laravel

Leave a Reply