Demo entry 5626900

Deneme

   

Submitted by anonymous on Jul 05, 2016 at 20:12
Language: PHP. Code size: 706 Bytes.

<?php

    function generate_safe_link_text($text){
        $convert_from = array('Ç', 'Ş', 'Ğ', 'Ü', 'İ', 'Ö', 'ç', 'ş', 'ğ', 'ü', 'ö', 'ı', '+', '#');
        $convert_to = array('c', 's', 'g', 'u', 'i', 'o', 'c', 's', 'g', 'u', 'o', 'i', 'plus', 'sharp');

        $text = strtolower(str_replace($convert_from, $convert_to, $text));
        $text = preg_replace("@[^A-Za-z0-9\-_\.\+]@i", ' ', $text);
        $text = trim(preg_replace('/\s+/', ' ', $text));
        $text = str_replace(' ', '-', $text);
        return $text;
    }

    echo generate_safe_link_text("Verilen stringi sef link yapısına çeviren fonksiyon"); // Çıktı : verilen-stringi-sef-link-yapisina-ceviren-fonksiyon

?>

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).