在匹配单词的最开头分割字符串

I'm trying to find out what function can split a given string so I come up with one substring beginning with the matched word and the other part. It's got a bit of a long since I started searching and I feel desperate, well so many functions on ways to split a string I just want your help to figure out what's the best way to do this splitting.

PHP's strstr can do this for you simply

Usage is:

 $fragment = strstr( $string, $search );

If you're running PHP 5.3 to get the part before the search term you can use the same function as:

 $fragment_before = strstr( $string, $search, true );
$str = 'hjae adj xyz asdj asdjs';

$search = 'xyz';
if(($pos = strpos($str, $search)) !== false)
{
    $before = substr($str, 0, $pos); // hjae adj 
    $after = substr($str, $pos); // xyz asdj asdjs
}

There are a few ways to split a string. I'm not sure what you exactly want, but I would advise you to check preg_split and explode.