<?php $string = "This is a string"; $words = explode(' ', $string); $pairs = []; for ($x = 0; $x < (count($words) -1); $x++) { $pairs[$x] = $words[$x] .' ' . $words[$x + 1]; } var_dump($pairs);
You have javascript disabled. You will not be able to edit any code.