Nikki

Adding a zero to a calculation

Posted 1 month ago by Nikki

This might be a simple and silly question, but I can't seem to get my head around it.

What I would like is that if my calculations needs a 0 at the end then it should put one.

For example I get 20.2 but what I want is 20.20

This is my code

@if(!empty($parent->price))
    @php
        $percent_price = $parent->price * 0.15;
        $price = $percent_price + $parent->price;
    @endphp

    <td>
        R{{ $price }}
    </td>
@endif

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.