1 2 3 4 5
<?php $name = "Stack Flow.jpg"; echo preg_replace('/[\s\-]+/', '_', $name ); ?>
1
Stack_Flow.jpg