Saturday, February 18, 2023

Format Number PHP dan JS

 1. php

<?php

function rupiah($angka){

$hasil_rupiah = "Rp " . number_format($angka,0,',','.');

return $hasil_rupiah;

}

echo rupiah(1000000);

?>


2. Js

<script>

let Rupiah = new Intl.NumberFormat('id-ID');

console.log(` ${Rupiah.format(123958)}`);

</script>

No comments:

Post a Comment

Set Cookie dan Remove Cookie dengan php vanilla.js

< html lang = "en" > < head >     < meta charset = "UTF-8" >     < meta name = "viewport...