php convert spaces to underscores
snippet in php

php replace space with underscore

user9378

$str = str_replace(' ', '_', $str);

php convert spaces to underscores

user6409

$str = str_replace(' ', '_', $str);