MOTOSHARE 🚗🏍️

Rent Bikes & Cars Directly from Owners

Motoshare connects vehicle owners with people who need bikes and cars on rent. Owners earn from idle vehicles, and renters get flexible ride options.

Visit Motoshare

Syntax ERROR: A non well formed numeric value encountered

Laravel

When you using @foreach value in a variable in your blade file and put any value and using any Mathematics function in your value for showing your document this type of error.

 @foreach($allcourses as $i => $allclass)

	<p>{{$allclass['total_fees_of_class']}}</p>
            <?php 
                        $fee = $allclass['total_fees_of_class']; 
                        $c = ($fee);
                        $a = (100);
                        $d = (20);
                        $e = $c * $d / $a;
                        $fee = $c + $e;
           ?>

               <span>
               		<b>{{$fee}}</b>
               </span>
@endforeach

Then, You can add (int) as prefix in your foreach value as “$c = (int)($fee);” and write as below code

               <?php 
                    $fee = $allclass['total_fees_of_class']; 
                    $c = (int)($fee);
                    $a = (100);
                    $d = (20);
                    $e = $c * $d / $a;
                    $fee = $c + $e;
               ?>

Your program will run.

0 0 votes
Article Rating
Subscribe
Notify of
guest

1
0
Would love your thoughts, please comment.x
()
x