SHARE
TWEET

Function Bulatkan Angka (Statis)

GarryLaly Mar 13th, 2014 339 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. $angka = 8161824.6;
  3. $potong1 = substr($angka, 0, 3);
  4. $potong2 = ceil(substr($angka, 3, strlen($angka)));
  5. $bulat = substr($potong2, 1, 1);
  6. $bulat1 = substr($potong2, 0, 1);
  7. $bulat2 = $bulat>=5?$bulat1+1:$bulat1;
  8. $nol = "";
  9. for ($i = 0;$i < strlen($potong2)-1;$i++) {
  10.     $nol .= "0";
  11. }
  12. echo $potong1.$bulat2.$nol;
  13. ?>
RAW Paste Data
Top