The funcion, using preg_mat_all
function getCapWords($string) { preg_match_all('/\b[A-Z][a-zA-Z]*\b/', $string, $matches); return $matches[0]; }
Now the test and action!
$words = getCapWords(@string); $words = array_unique(@$words); foreach ($words as $palavra) if ( $palavra == strtoupper($palavra) { echo 'uppercased word'; }