- var_export: documentation ( source)
- explode: documentation ( source)
<?php
$string = "This is my test case for an example.";
$words = explode(' ', $string);
$result = [];
for ($i = 1, $max = count($words); $i < $max; ++$i) {
$result[] = $words[$i - 1] . ' ' . $words[$i];
}
var_export($result);