I'd like to split this string:
Womens Team Ranking Round
in two but only after the second space, for example, it should be like that:
Womens Team
Ranking Round
Thanks for your help.
I'd like to split this string:
Womens Team Ranking Round
in two but only after the second space, for example, it should be like that:
Womens Team
Ranking Round
Thanks for your help.
Answering the question as asked, this will give you two strings consisting of the original divided at the second space:
$strings = preg_split ('/ /', 'Womens Team Ranking Round', 3);
$second=array_pop($strings);
$first=implode(" ", $strings);
If you want to split on one or more spaces, use / +/ for the pattern.
You could also do it with a single regex:
$string='Womens Team Ranking Round';
preg_match('/^([^ ]+ +[^ ]+) +(.*)$/', $string, $matches);
This will give you the first two words in $matches[1] and the remainder of the string in $matches[2].
Answering a more complicated question than asked: If you want to break a longer string every two words, then you can remove the last parameter from preg_split and then use array_slice in a loop to re-join the members of the array two at a time.
Answering a question not actually asked at all but possibly the reason for a question like this: Don't forget wordwrap.