PHP: split
PHP: split
Out of context: Reply #8
- Started
- Last post
- 8 Responses
- enobrev0
explode is good..
$my_string = 'The sentence I want to break down into the first six words.';l
$split_sting = explode(' ', $my_string);
$first_six = '';
for($i = 0; $i < 6; $i++) {
$first_siz .= $split_string[$i];
}----
There's also a way of doing it in regex (preg or ereg functions), although I don't remember the pattern, and I don't remember where I have it.
good luck.