Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Word do php - liczenie słów
hab
post
Post #1





Grupa: Zarejestrowani
Postów: 50
Pomógł: 0
Dołączył: 23.11.2004

Ostrzeżenie: (0%)
-----


Musze zrobić skrypt który liczy słowa w dokukmentach i ...

nie ma problemu jeśli jest to txt lub rtf ale można jakoś policzyć słowa w wordzie?

może php ma wbudowane jakieś funkcje współpracujące z wordem

ktoś ma jakiś pomysł od której strony to ugryźć (IMG:http://forum.php.pl/style_emoticons/default/questionmark.gif)


może jakiś konwerter doc do txt ?

Ten post edytował hab 10.04.2006, 15:42:21
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
TomASS
post
Post #2





Grupa: Zarejestrowani
Postów: 1 660
Pomógł: 13
Dołączył: 9.06.2004
Skąd: Wrocław i okolice

Ostrzeżenie: (0%)
-----


Skorzystaj z tych stron:
converter doc 2 html
doc 2 txt
-- || --

A co do liczenia słów:
  1. <?php
  2. // To test, uncomment the 3 lines below and call the script.
  3. // $text = "Frites - &agrave; la année 1984 ...";
  4. // $word_count = count_words($text);
  5. // echo " - $word_count - ";
  6.  
  7. // The code you need is below:
  8.  
  9. function count_words($string) {
  10.  
  11. $word_count = 0;
  12. $string = eregi_replace(" +", " ", $string);
  13. $string = explode(" ", $string);
  14.  
  15. while (list(, $word) = each ($string)) {
  16. if (eregi("[0-9A-Za-z&Agrave;-Ö&Oslash;-ö&oslash;-&yuml;]", $word)) {
  17. $word_count++;
  18. }
  19. }
  20. return($word_count);
  21. }
  22. ?>

strona
Go to the top of the page
+Quote Post

Posty w temacie


Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 10.10.2025 - 18:27