PHP Script to create URL from string. It retails only URL Safe characters in the strings. So, now easily create URL Slug from text string for your Search engine optimization needs.
<?php
/*
Name : PHP function to Create URL Slug from a text string
It is great tool for generating SEO URLs.
*/
function createUrlSlugFromString($string){
// Remove spaces from front and end of the string
$string = strtolower(trim($string));
// Change all non-alphanumeric character sequences to -
$string = preg_replace('/[^a-z0-9-]/', '-', $string);
// Change multiple hyphens to single hyphens
$urlSlug = preg_replace('/-+/', "-", $string);
// Remove trailing - from the slug
$urlSlug=trim($urlSlug,"-");
// We are done! Now return the sluf back.
return $urlSlug;
} // End of Create URL Slug from a text string function
// Calling the URL Slug creation function
echo createUrlSlugFromString ( " This is some text with multiple spaces and punctionations (,.?)");
?>
PHP snippet to parse a text and remove all non alphanumeric characters from it.
Price $5 Order Now
I want a function to find number of occurrences of a word in a given text and then give their positions as comma separated list.
Price $5 Order Now
I want a function to validate a given and tell if it safe URL slug i.e. it should check that it does not have any special characters, spaces or any non-alphanumeric characters except hyphens
Price $5 Order Now
This PHP Code snippet lists all files in a folder and hyperlinks them accordingly. Very clean, easy to use function....
This is a simple PHP function to parse text provided and automatically hyperlink the links in the text.
This PHP function extracts all numbers from a String and prints them as a comma separated list of numbers. Ready...
PHP Script to create URL from string. It retails only URL Safe characters in the strings. So, now easily create...
PHP Script to scan a text and extract all email ids contained in the text. It outputs email addresses as...
PHP Script to create thumbnail of any image (.jpg, .png and .gif). This create thumbnail function is ready to use....
PHP Script to Generate Random Password. You can set the list of characters that you want to be used in...
100% Free PHP folder to gallery script. Just give the name of folder and it will generate gallery of all...