Reputation: 1229
I'm trying to replace dashes and the '.php' extension on a string, for example:
Original String:
my-awesome-link.php
Resulting String:
My Awesome Link
Any help greatly appreciated!
Upvotes: 0
Views: 110
Reputation: 50573
The full solution would be this:
$pageName = ucwords(str_replace(['-','.php'],[' ',''], $getPageName[1]));
Upvotes: 0
Reputation: 57408
You can use str_replace
to get rid of both '-' and '.php', then UCWords
to go from 'my awesome link' to 'My Awesome Link'.
Upvotes: 2