- Output for 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
- array ( 0 => 'PHP What is PHP', 1 => 'PHP What is', 2 => 'PHP What', 3 => 'PHP', )
<?php
$string = "PHP What is PHP";
do {
$result[] = $string;
$string = preg_replace('/\s+\S+$/', '', $string, 1, $count);
} while ($count);
var_export($result);