<?php
$string = "This is my test case for an example";
function splitStrByWords($sentence, $wordCount=2) {
$words = array_chunk(
explode(' ', $sentence),
$wordCount
);
return array_map(
'implode',
array_fill(0, sizeof($words), ' '),
$words
);
}
var_export(splitStrByWords($string));