Last active
February 29, 2024 20:09
-
-
Save unique1984/6ac140c8d5f963586caff1423d955e91 to your computer and use it in GitHub Desktop.
php ile sayıyı yazıya çevirme
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
include "yaziyacevir.php" ; | |
?> | |
<HTML> | |
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=UTF-8"> | |
<BODY> | |
<form name="form" method="post" action=""> | |
<input type="text" name="para" maxlength="15"> | |
<input type="submit" name="Okut" value="Okut"> | |
</form> | |
<?php echo @"$yazili"; ?> | |
</BODY> | |
</HTML> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function uclu($uclu) { | |
$uclu=trim($uclu); | |
$yazi = array( | |
"0" => array("2" => "","1" => "","0" => ""), | |
"1" => array("2" => "Bir","1" => "On","0" => "Yüz"), | |
"2" => array("2" => "İki","1" => "Yirmi","0" => "İkiyüz"), | |
"3" => array("2" => "Üç","1" => "Otuz","0" => "Üçyüz"), | |
"4" => array("2" => "Dört","1" => "Kırk","0" => "Dörtyüz"), | |
"5" => array("2" => "Beş","1" => "Elli","0" => "Beşyüz"), | |
"6" => array("2" => "Altı","1" => "Altmış","0" => "Altıyüz"), | |
"7" => array("2" => "Yedi","1" => "Yetmiş","0" => "Yediyüz"), | |
"8" => array("2" => "Sekiz","1" => "Seksen","0" => "Sekizyüz"), | |
"9" => array("2" => "Dokuz","1" => "Doksan","0" => "Dokuzyüz") ); | |
$ucluyazi=""; | |
for ($i=0;$i<=2;$i++){ | |
@$ucluyazi.=$yazi[(substr($uclu,$i,1))][$i]; | |
} | |
return($ucluyazi); | |
} | |
function yaziyacevir($sayi) { | |
$olay = array("0" =>" ","1" =>" ","2" =>"Bin","3" =>"Milyon","4" =>"Milyar","5" =>"Trilyon"); | |
$sayi = trim($sayi); | |
$uzunluk = strlen($sayi); | |
if ($uzunluk > 15) exit("Girdiğiniz Sayı Çok Büyük..."); | |
$kalan = $uzunluk-3*($tane=floor($uzunluk/3)); | |
if ($kalan!=0) { | |
$tane++; | |
for ($i=0;$i<=$kalan;$i++) { | |
$sayi="0".$sayi; | |
$uzunluk++; | |
} | |
} | |
$yazi=""; | |
for ($i=$tane;$i>=1;$i--){ | |
if (!($i==2 and (substr($sayi,($uzunluk-($i*3)),3)=="001"))) | |
$yazi.=uclu(substr($sayi,($uzunluk-($i*3)),3)); | |
if ((substr($sayi,($uzunluk-($i*3)),3)!="000")) $yazi.=$olay[$i]; | |
} | |
return ($yazi); | |
} | |
if (isset($_POST['Okut'])){ | |
@$para = $_POST['para']; | |
@$para =str_replace(",",".",$para); | |
@$para=round($para,2); | |
@$parca=explode(".",$para); | |
@$tampara=$parca[0]; | |
@$kurus=$parca[1]; | |
@$kurusuzunluk=strlen($kurus); | |
if (@$kurusuzunluk==1){$kurus=$kurus*10;} | |
if ($tampara>0){$tam ="".(yaziyacevir($tampara))."TL";} | |
if ($kurus>0){$onda ="".(yaziyacevir($kurus))."KRŞ";} | |
@$yazili= "$tam $onda"; | |
} | |
if (isset($_POST['sayiokut'])){ | |
@$sayi = $_POST['para']; | |
@$sayi =str_replace(",",".",$sayi); | |
@$sayi=round($sayi,2); | |
@$parca=explode(".",$sayi); | |
@$tamsayi=$parca[0]; | |
@$ondalik=$parca[1]; | |
@$ondauzunluk=strlen($ondalik); | |
if (@$ondauzunluk==1){$ondalik=$ondalik*10;} | |
if ($tamsayi>0){$tam ="".(yaziyacevir($tamsayi))."";} | |
if ($ondalik>0){$onda ="".(yaziyacevir($ondalik))."";} | |
@$yazili= "$tam"; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment