Jump to content

Recommended Posts

Ive read abiut the money_format() but i cant seem to make it work.

 

here is my code

 

<?php
$price = $price * 1.02;

              if ( $result != 0 ) 
              {
                echo "You are paying buy credit card. Your ticket has a transaction fee of 2.5%. Your new ticket price is $$price your card has been charged and your ticket will be dispatched shortly. Please make a note of the order id which is $id. Thankyou and enjoy the match";
              }
              else 
              {
                echo "Failed to buy";
              }
?>

 

Its displaying the price as $20.4 which in maths is correct but in money terms looks wrong. If i changed the code to

<?
Your new ticket price is $$price0
?>

 

it would work but only if the new price rounded to a 10. if it the price was 20.41 it would display 20.410 which again looks wrong.

 

is there a way of letting the php know it is money and needs to display 20.40

 

thanks in advnace

Link to comment
https://forums.phpfreaks.com/topic/168527-solved-50-instead-of-5/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.