Question: How do you get last 3 words from the string?

I managed to get working doing like this:

```
$statusMessage = explode(" ", str_replace('&nbsp;'," ",$retStatus->plaintext));
$SliceDate = array_slice($statusMessage, -3, 3);
$date = implode(" ", $SliceDate);
echo $date;

```

Is there a shorter way? Maybe there is a PHP function that I did not know..

Answer: 
explode() is good, but once you've done that you can use

```
$size = sizeof($statusMessage);

```

and last 3 are 

```
$statusmessage[$size-1]; 
$statusmessage[$size-2]; 
$statusmessage[$size-3]; 

```
preg\_match("/(?:\w+\s\*){1,3}$/", $input\_line, $output\_array);

this catches 1 to 3 words and if the row is only 3 long, other regex one was close