Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

convert text to slug php

public static function createSlug($str, $delimiter = '-'){

    $slug = strtolower(trim(preg_replace('/[s-]+/', $delimiter, preg_replace('/[^A-Za-z0-9-]+/', $delimiter, preg_replace('/[&]/', 'and', preg_replace('/[']/', '', iconv('UTF-8', 'ASCII//TRANSLIT', $str))))), $delimiter));
    return $slug;

}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #convert #text #slug #php
ADD COMMENT
Topic
Name
9+8 =