Explain "Parse through" - you can split it into an array using explode(), or you can go through it letter by letter... Or if you're up for it you can try using preg_replace(), depends entirely on what you're trying to do. Probably explode() will be best.
To change every space into an underscore, do:
$str= str_replace(" ", "_", $str);