I need to get a news headline and display the URL. To do this, I want to fetch the title in the database and replace every blank space between one word and another, with a hyphen. For example: "News test" would read "Test-news".
I've tried:
$titulo_novo = preg_replace('<\W+>', "-", $titulo);
//$titulo é o titulo vindo do banco de dados