- PHP

How to change Dot to Comma in PHP

Use str_replace() function.

str_replace('.', ',', $string);

Example:

Change the dot to comma to display the price in more user-friendly format.

<?php

$price = '23.39';
$newPrice = str_replace('.', ',', $price);

echo $newPrice;

?>

Output: 23,39