Check Array in Laravel

User
Survey TextArea

check if $competenciesArr is array

Assistant
To check if `$competenciesArr` is an array in Laravel, you can use the `is_array()` function. Here's how you can update your code:

@if(is_array($competenciesArr))
    <div id="page-{{ count($competenciesArr) + 1}}" class="page" style="display: none">
        <div class="row">
            <div class="col-md-6 col-lg-6">
                <h4>Survey TextArea</h4>
            </div>
        </div>
    </div>
@else
    {{-- Handle case when $competenciesArr is not an array --}}
@endif

This checks if `$competenciesArr` is an array, and if it is, it will display the content. If it is not an array, you can handle the case as needed inside the `@else` block.

Leave a Comment

Your email address will not be published. Required fields are marked *