The set of characters you intend to replace with -
belong inside a []
character class. In there, the .
does not require escaping.
$out = preg_replace('#[/._\s]#', '-', $date);
When you are dealing with /
as one of your expected characters, it is recommended to use a different character such as #
as the delimiter.
$date = '01/02/2013';
echo preg_replace('#[/._\s]#', '-', $date);
// 01-02-2013
$date = '01.02.2013';
echo preg_replace('#[/._\s]#', '-', $date);
// 01-02-2013
// Or mixed...
$date = '01 02/2013';
echo preg_replace('#[/._\s]#', '-', $date);
// 01-02-2013
In your attempt, not using a character class []
caused your expression to expect the characters /-._\s
literally in succession.