This is probably a simple thing, but I don't know how to declare and increment an integer variable in a view in Laravel.
I have a couple foreach loops that I am using:
@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.