This is probably the shortest example that came to my mind:
list($first) = explode("/", $mystring);
1) list()
will automatically assign string until "/"
if delimiter is found
2) if delimiter "/"
is not found then the whole string will be assigned
...and if you get really obsessed with performance, you may add extra parameter to explode explode("/", $mystring, 2)
which limits maximum of the returned elements.