Skip to content
Advertisement

number_format in between strings

I am new to php and I have this code that will supposedly display floating numbers with comma. I have the following part of my code.

<?php echo "          
            <table>
                     <tr>
                     <td>Bracket</td>
                     <td>Detailed Computation</td>
                     <td>Total</td>
                     </tr>
                 <tr>
                     <td>41- Up</td>
                     <td>Commodity Charge: {$cc_fortyone_above} x {$diff_fortyone_above} cu. m.</td>
                     <td>{$total_fortyone_above}</td>
                </tr> 
     </table>";
  ?>

Advertisement

Answer

<?php echo "          
        <table>
                 <tr>
                 <td>Bracket</td>
                 <td>Detailed Computation</td>
                 <td>Total</td>
                 </tr>
             <tr>
                 <td>41- Up</td>
                 <td>Commodity Charge: ".number_format($cc_fortyone_above)." x ".number_format($diff_fortyone_above)." cu. m.</td>
                 <td>{$total_fortyone_above}</td>
            </tr> 
 </table>"; ?>
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement