1 2 3 4 5 6
<?php $test = "I'm only a string - not a number or something like that. You know that, don't you?"; echo preg_replace('/[^\w\.-]/', '_', $test); ?>
1
I_m_only_a_string_-_not_a_number_or_something_like_that.__You_know_that__don_t_you_