PHP - Replace forward slash (/) with dash (-)
I started out wanting to replace spaces, special characters etc. with dashes. However, I can't seem to find the right way to replace a forward slash with a dash. I've looked all over the internet, some people suggesting using the .htaccess-file though I don't think that fits my purpose. My coding so far:
Example: You've got 1 new message (12/07/2016)
As I would like to have it: you-ve-got-1-new-message-12-07-2016
<?php
$message_original = $row_message ['title'];
$message_lower = strtolower($message_original);
$message_alpha = preg_replace("/[^a-z0-9_\s-]/", "", $message_lower);
$message_dash = preg_replace("/[\s-]+/", " ", $message_alpha);
$message = preg_replace("/[\s_]/", "-", $message_dash);
?>
