<?php $input_string = "this is a test."; $pieces = explode(",", $input_string); echo "Names in List: <BR/>\n"; foreach($pieces as $name) { echo trim($name) . "<BR/>\n"; } ?>