getfluid
3/9/2018 - 7:23 PM

Slugify -> take string and convert to lowercase, remove spaces and replace with '-'

Slugify -> take string and convert to lowercase, remove spaces and replace with '-'

/**
 * Convert string to dash-delimited slug.
 *
 * @access public
 * @param string $string
 * @return string
 */
function slugify($string, $delimiter = '-', $echo = true) {
	$string = strtolower($string);
	$string = str_replace(' ', $delimiter, $string);

	if ($echo) {
		echo $string;
	} else {
		return $string;
	}
}


/* example: */

<?php slugify('string')  ?>