Given:
$URL = "https://somedomain.com/these-are-words/";
or
$URL = "http://somedomain.com/these-are-words/";
How do I get?:
"these are words"
Given:
$URL = "https://somedomain.com/these-are-words/";
or
$URL = "http://somedomain.com/these-are-words/";
How do I get?:
"these are words"
$url = "https://somedomain.com/these-are-words/";
$path=parse_url($url, PHP_URL_PATH); //extract the path
$words=str_replace('-',' ',trim($path,'/')); //replace the hyphen with spaces and remove the /'s
echo $words; //these are words