fork(12) download
  1. <?php
  2.  
  3. $text = "Başka, küskün otomobil kaçtı buraya küskün otomobil neden kaçtı
  4. kaçtı buraya, oraya KISMEN @here #there J.J.Johanson hep.
  5. Danny:Where is mom? I don't know! Café est weiß for 2 €uros";
  6.  
  7. $namePattern = '/[\s,:?!]+/u';
  8. $wordsArray = preg_split($namePattern, $text, -1, PREG_SPLIT_NO_EMPTY);
  9. $wordsArray2 = array_count_values($wordsArray);
  10. arsort($wordsArray2);
  11. print_r($wordsArray2);
  12.  
Success #stdin #stdout 0.01s 20568KB
stdin
Standard input is empty
stdout
Array
(
    [kaçtı] => 3
    [otomobil] => 2
    [buraya] => 2
    [küskün] => 2
    [Café] => 1
    [know] => 1
    [I] => 1
    [est] => 1
    [don't] => 1
    [2] => 1
    [€uros] => 1
    [mom] => 1
    [for] => 1
    [weiß] => 1
    [Danny] => 1
    [@here] => 1
    [KISMEN] => 1
    [oraya] => 1
    [neden] => 1
    [#there] => 1
    [J.J.Johanson] => 1
    [Where] => 1
    [Başka] => 1
    [hep.] => 1
    [is] => 1
)