How can I get the substring before the first space or dot?
Like
$string = "test.test"
//result = test
$string = "test doe"
//result = test
Sure I can use explode two times, but I am sure that's not the best solutions.
If you want to split on several different chars, take a look at preg_split
//split string on space or period:
$split=preg_split('/[ \.]/', $string);