To convert a string to slug in PHP you can use the following snippet.
Sample PHP
function StringToSlug($input, $replacement){ (!isset($replacement) || trim($replacement)===''){ $replacement = "/" } $input = strtolower(trim($input)); $input = preg_replace('/[^a-z0-9-]/', $replacement, $input); $input = preg_replace('/-+/', $replacement, $input); return $input; }
RT @CodeSnippetsNET: How to convert a string to slug in #PHP http://t.co/2jS5KnH064 #html #css #js #javascript #code
RT @CodeSnippetsNET: How to convert a string to slug in #PHP http://t.co/2jS5KnH064 #html #css #js #javascript #code