function extract_only_words_with_first_letter_lowercase($s) {
$words = array();
$start = 0;
while (($end = strpos($s, " ", $start)) !== false) {
$word = substr($s, $start,$end - $start);
if (ctype_lower($word[0])) {
array_push($words, $word);
}
$start = $end + 1;
}
if (ctype_lower(substr($s, $start)[0])) {
array_push($words, substr($s, $start));
}
return $words;
}
$s = "PHP is a General-purpose scripting language for web development";
$words = extract_only_words_with_first_letter_lowercase($s);
foreach ($words as $w) {
echo $w,"\n";
}
/*
run:
is
a
scripting
language
for
web
development
*/