Skip to content

Instantly share code, notes, and snippets.

@PaulFr
PaulFr / stats_text.php
Created November 12, 2012 10:22
statistiques d'un texte
<?php
$text = file_get_contents('ok.txt');
$words = explode(' ', $text);
$top = 50;
echo 'Il y a '.count($words)." mots\n";
echo 'Il y a '.count(array_unique($words))." mots uniques\n";
echo 'Il y a '.(strlen($text)).' caractères (en comptant les espaces)'."\n";
echo 'Il y a '.(strlen(str_replace(' ', '',$text))).' caractères (sans compter les espaces)'."\n";

Keybase proof

I hereby claim:

  • I am paulfr on github.
  • I am faw (https://keybase.io/faw) on keybase.
  • I have a public key whose fingerprint is 1B7A 932F C502 EC9D 0567 FB09 CBB2 030D E7CC ABA1

To claim this, I am signing this object: