<?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);
You have javascript disabled. You will not be able to edit any code.