I need something like this:
@if ($array.length > 0) {{-- expr --}} @endif
is this possible?
We can find the size of an array using the sizeof() operator as shown: // Finds size of arr[] and stores in 'size' int size = sizeof(arr)/sizeof(arr[0]);
You can access the array in the laravel blade using ['key']. Here are some examples like {{ $user['name'] }} and {{ $users[0]['name'] }}.
Array size. The size of an array is the product of the lengths of all its dimensions. It represents the total number of elements currently contained in the array. For example, the following example declares a 2-dimensional array with four elements in each dimension.
It is possible with the count
function, like so:
@if (count($array) > 0) {{-- expr --}} @endif
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With