How can I know the size of an array in Blade template?

Andy.Diaz picture Andy.Diaz · Jul 18, 2014 · Viewed 84.4k times · Source

I need something like this:

@if ($array.length > 0)
    {{-- expr --}}
@endif

is this possible?

Solution!

@if (count($array) > 0)
    {{-- expr --}}
@endif

Answer

Andy.Diaz picture Andy.Diaz · Jul 18, 2014

Ouch...

@if (count($array) > 0)
    {{-- expr --}}
@endif