这可能很简单,但我不知道如何在Laravel的视图中声明和递增整数变量.
我使用了几个foreach循环:
@foreach($fans as $fan)
@foreach ($array as $x)
@if($fan->fbid==$x)
@endif
@endforeach
@endforeach
I would like to throw in an integer variable $a, that counts the number of times it makes it through the if statement. Like:
$a=0;
@foreach($fans as $fan)
@foreach ($array as $x)
@if($fan->fbid==$x)
$a++;
@endif
@endforeach
@endforeach
{{$a}}
What is the proper syntax for doing this in a view in Laravel? Thank you.