Arapça Türkçe Harflerin ve Kelimelerin Okunuşu

Not: Okunuş tüm sesli harfleri içermez. Bu yüzden gerçek değil, programsal okunuşu oluşturur.

<?php
header('Content-Type: text/html; charset=utf-8');
class Oku{
	var $turkce=['b','z','t','m','t','r','z','n','s','z','a','h','c','s','ğ','h','g','f','h','s','ş',
		'd','d','k','e','e','i','ü','i','e','e','y','t','y','l','v','en','ün','in','e','ü','i','~','o'];
	var $arapca=['\u0628','\u0630','\u0637','\u0645','\u062a','\u0631','\u0638','\u0646',
		'\u062b','\u0632','\u0639','\u0647','\u062c','\u0633','\u063a','\u062d','\u0642','\u0641','\u062e','\u0635',
		'\u0634','\u062f','\u0636','\u0643','\u0623','\u0621','\u0626','\u0624','\u0625','\u0622','\u0627','\u0649',
		'\u0629','\u064a','\u0644','\u0648','\u064b','\u064c','\u064d','\u064e','\u064f','\u0650','\u0651','\u0652'];
	var $onceki=["lr","nb","nl","nr","nm","ny","ns","nt","nd","nc","nz","nş","nk","ng","nf","bm","gk"];
	var $sonraki=["rr","mb","ll","rr","mm","yy","s","t","d","c","z","ş","k","g","f","mm","kk"];
	function arapcaTurkce($metin){
		$unicode=str_replace('"',"",json_encode($metin));
		$turkce=str_replace($this->arapca,$this->turkce,$unicode);
		return str_replace($this->onceki,$this->sonraki,$turkce);
	}
	function turkceArapca($metin){
		mb_internal_encoding('UTF-8');
		$metin=mb_strtolower($metin);
		$metin=str_replace(["u","o","ö","ı",],["ü","ü","ü","i"],$metin);
		$metin=str_replace($this->sonraki,$this->onceki,$metin);
		$metin=str_replace($this->turkce,$this->arapca,$metin);
		return json_decode('"'.$metin.'"');
	}
}
$cevir=new Oku;
echo $cevir->arapcaTurkce("ؤلؤنثعن ىعنذئلئم");
echo "<br>";
echo $cevir->turkceArapca("Ulusan Yazılım");
echo "<br>";

Çıktısı

ؤلؤنثعن ىعنذئلئم
ülüsan yazilim

 

Değişik Stillerde Türkçe Tarih Gösterimi

<?php
class tarih_tr{
	function gun_tr($gun){
		switch($gun){
			case 0 : $gun = "Pazar";
				break;
			case 1 : $gun = "Pazartesi";
				break;
			case 2 : $gun = "Salı";
				break;
			case 3 : $gun = "Çarşamba";
				break;
			case 4 : $gun = "Perşembe";
				break;
			case 5 : $gun = "Cuma";
				break;
			case 6 : $gun = "Cumartesi";
				break;
		}
		return $gun;
	}
	function ay_tr($ay){
			switch($ay){
				case 1 : $ay = "Ocak";
					break;
				case 2 : $ay = "Şubat";
					break;
				case 3 : $ay = "Mart";
					break;
				case 4 : $ay = "Nisan";
					break;
				case 5 : $ay = "Mayıs";
					break;
				case 6 : $ay = "Haziran";
					break;
				case 7 : $ay = "Temmuz";
					break;
				case 8 : $ay = "Ağustos";
					break;
				case 9 : $ay = "Eylül";
					break;
				case 10 : $ay = "Ekim";
					break;
				case 11 : $ay = "Kasım";
					break;
				case 12 : $ay = "Aralık";
					break;
			}
		return $ay;
	}
	function hazirla($stil){
		if(empty($stil) or $stil>4 or $stil<1){
			$stil = 4;
		}
		if($stil==1){
			$veri = date("d")."/".date("m")."/".date("y");
		}elseif($stil==2){
			$veri = date("d")."/".date("m")."/".date("Y");
		}elseif($stil==3){
			$veri = date("d")."/".date("m")."/".date("Y")." ".$this->gun_tr(date("w"));
		}elseif($stil==4){
			$veri = date("d")." ".$this->ay_tr(date("n"))." ".date("Y")." ".$this->gun_tr(date("w"));
		}
	return $veri;
	}
}
$dt = new tarih_tr;
echo $dt->hazirla(1);
echo "<br>";
echo $dt->hazirla(2);
echo "<br>";
echo $dt->hazirla(3);
echo "<br>";
echo $dt->hazirla(4);
?>

Çıktısı

30/05/18
30/05/2018
30/05/2018 Çarşamba
30 Mayıs 2018 Çarşamba

 

Sef Link Sistemi ile Türkçe Kullanıcı Profil Adresi Oluşturmak

Bu kod ile siteniz/kullanıcı tarzında profil sayfası oluşturabilirsiniz.

.htaccess dosyası oluşturun ve içine bu kodları ekleyin.

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([0-9a-üöçşığzA-ÜÖÇŞİĞZ-_/]+)$ index.php?user=$1

index.php dosyası oluşturun ve içine bu kodları ekleyin.

<?php
header("Content-type: text/html; charset=utf8");
if(@$_GET["user"]){
 $user = array_filter(explode("/", @$_GET["user"]));
 $username = @$user[0];
 if ($username == "kullanıcı"){
 echo "<i>$username</i> profiline hoşgeldiniz";
 }else{
 echo "böyle bir kullanıcı bulunamadı!";
 }
}
?>