I am Using Laravel and my code was working fine i don’t know if this error is because of server or something else. but i guess in blade template it is having trouble converting @php to i would be happy if you will guide me
my code look like this
<tbody>
@foreach ($arrData as $k => $data)
@php($i = 1)
@php($yearTotal = 0)
@php($futureYearTotal = 0)
@foreach ($data as $k2 => $yd)
<tr>
<td><h6><span class="badge bg-light">{{$k}} {{ $k2 }}</span></h6></td>
<td class="total-amount" align="right">{{ number_format($yd['total']??0, 2, ',', ' ') }}{{ $yd['currency'] }}</td>
</tr>
@php($yearTotal += $yd['total'])
@endforeach
@endforeach
</tbody>
2
Answers
I think you are using wrong with laravel blade php directive
https://laravel.com/docs/10.x/blade#raw-php
Since you have more than one PHP lines of code, you can use this syntax: