how to display cash number format in a php code?

Member Avatar for iamthwee

Please give an example.

cash_system value suppose to show for example. 994.00 but instead it shows 994.

<?php

  echo "Cash:", " ". $info['cash_system'];
  echo "<BR>";
  ?>

will this work with my code or do i need to insert that number format under it?

Member Avatar for iamthwee

Please try:

echo "Cash:", " ". number_format($info['cash_system'], 2, '.', '');

my go to for formatting cash is: echo sprintf("%01.2f",$someFloat);

thanks this works. This will be marked as solved! Thanks everyone!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.