I need to split the string into two parts. The string contains words separated by a space, and can contain any number of words, for example:
$string = "one two three four five";
The first part should contain all the words except the last. The second part should contain only the last word.
Can anyone advise?
EDIT: two parts should be returned as strings, not arrays, for example:
$part1 = "one two three four";
$part2 = "five";
php
Gstar
source share