php - Make all lower case and replace spaces with - -
i trying generate html pages , have:
$category="category name"; $zone="zone name";
i trying $page="category-name-in-zone-name.html"
you're looking concept of 'slug creation':
function makeslug($input) { $interim = iconv('utf-8', 'ascii//translit//ignore', $input); $interim = preg_replace("/[\"']+/i", '', $interim); $interim = preg_replace("/[^a-z0-9\\d]+/i", '-', $interim); homecoming trim(strtolower($interim), ' -'); } echo makeslug("$category in $zone").'.html';
demo here.
php
No comments:
Post a Comment