First, you are printing the values of $i->price and $i->old_price, not performing a calculation. Next, this x is not a mathematical operator; it should be * for multiplication. Finally, if you can, organise your data in the Controller (or Composer) not in the View, otherwise, this would be your calculation
Assuming each $i is a Product instance with a price and old_price attributes, then it should be working as expected; what are you getting?
If $i (a Product?) is an Eloquent Model, you could move this logic off the Blade template into an accessor method on the Model, e.g.
// Product.php
class Product extends Model
{
// ... other code
public function getDiscountAttribute()
{
return ($this->price/$this->old_price) * 100;
}
}
Then your view template can get the computed discount attribute on the model:
@foreach($products as $product)
<tr>
<td>{{ $product->discount }}</td>
</tr>
@endforeach
I use "discount" here, but your calculation probably represents something else