How to Count two array in foreach loop

Posted 3 months ago by Kareimovich

Hi everybody here I have 2 paths so I return 2 arrays of tasks I need to count each array valuse So in last I get

[6, 4] not [10]

  @foreach ($Submpaths as $path)
     @foreach ($path->pathtags as $Tag)
            @php  $a=array();  @endphp 
             @foreach ($Tag->Tasks as $Task)  

                     @if (!in_array($Task->id,$a))
    
            <li class="list-group-item"> Task : {{ $Task->task_name }}  </li>

                 @php
                 array_push($a,$Task->id);
            @endphp
           
                         @endif
                     @endforeach
                  @endforeach
                @endforeach
           @endforeach

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

Reply to

Use Markdown with GitHub-flavored code blocks.