<?php
$words = "stack,overflow,em,portugûes";
for($i = 0; $i < count($palavras); $i++){
$palavra = $palavras[$i];
// Se a chave não existir, crie-a com valor zero:
if (!isset($ocorrencias[$palavra])) { $ocorrencias[$palavra] = 0;
}
$ocorrencias[$palavra]++;
}
PD9waHAKCiR3b3JkcyA9ICJzdGFjayxvdmVyZmxvdyxlbSxwb3J0dWfDu2VzIjsKJHBhbGF2cmFzID0gZXhwbG9kZSgnLCcsICR3b3Jkcyk7CiRvY29ycmVuY2lhcyA9IGFycmF5KCk7Cgpmb3IoJGkgPSAwOyAkaSA8IGNvdW50KCRwYWxhdnJhcyk7ICRpKyspewoJCiAgICAkcGFsYXZyYSA9ICRwYWxhdnJhc1skaV07CiAgICAKICAgIC8vIFNlIGEgY2hhdmUgbsOjbyBleGlzdGlyLCBjcmllLWEgY29tIHZhbG9yIHplcm86CiAgICBpZiAoIWlzc2V0KCRvY29ycmVuY2lhc1skcGFsYXZyYV0pKSB7CiAgICAJJG9jb3JyZW5jaWFzWyRwYWxhdnJhXSA9IDA7CiAgICB9CiAgIAogICAgJG9jb3JyZW5jaWFzWyRwYWxhdnJhXSsrOwogICAKfQoKcHJpbnRfcigkb2NvcnJlbmNpYXMpOw==