473,770 Members | 4,553 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

str_word_count

Hello,

on page http://www.php.net/manual/en/functio...word-count.php
it's stated that: "For the purpose of this function, 'word' is defined as a
locale dependent string"

But it does not seem to work, the output of the following script is
string(10) "fr_FR.utf8 " Array ( [0] =hello [1] =conomie [2] =bla )

I think, that "économie" should be recognized as word.

Here is the test-script:

<?
echo '<html><head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
</head><body>';
var_dump(setloc ale(LC_ALL, 'fr_FR.utf8'));
print_r(str_wor d_count('hello économie bla, 1));
echo '</body></html>';
?>

Could someone help please?
My PHP version is 5.1.2.

Greetings, Peter

--
email: pmrb at free.fr
http://pmrb.free.fr/contact/
Aug 25 '06 #1
2 2193
*** Peter Münster escribió/wrote (Fri, 25 Aug 2006 10:04:32 +0200):
But it does not seem to work, the output of the following script is
string(10) "fr_FR.utf8 " Array ( [0] =hello [1] =conomie [2] =bla )
Where's the output for var_dump(setloc ale(LC_ALL, 'fr_FR.utf8'))? Locales
are system dependent and I'd bet it's printing FALSE in order to say
fr_FR.utf8 is not available.

var_dump(setloc ale(LC_ALL, 'fr_FR.utf8'));
print_r(str_wor d_count('hello économie bla, 1));
echo '</body></html>';

--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor con rayos UVA: http://www.demogracia.com
--
Aug 25 '06 #2
On Fri, 25 Aug 2006, Alvaro G. Vicario wrote:
*** Peter Münster escribió/wrote (Fri, 25 Aug 2006 10:04:32 +0200):
But it does not seem to work, the output of the following script is
string(10) "fr_FR.utf8 " Array ( [0] =hello [1] =conomie [2] =bla )

Where's the output for var_dump(setloc ale(LC_ALL, 'fr_FR.utf8'))? Locales
are system dependent and I'd bet it's printing FALSE in order to say
fr_FR.utf8 is not available.
Hello Alvaro,

the output of "var_dump(setlo cale(LC_ALL, 'fr_FR.utf8')) is:
string(10) "fr_FR.utf8 "

Do you have other ideas, what's going wrong here?

Cheers, Peter

--
email: pmrb at free.fr
http://pmrb.free.fr/contact/
Aug 28 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
4023
by: Phil Powell | last post by:
Relevancy scores are normally defined by a MySQL query on a table that has a fulltext index. The rules for relevancy scoring will exclude certain words due to their being too short (minimum default is 4 letters). This is the Fed. Everything is a TLA (three-letter acronym). Therefore, since I'm building a PORTABLE web application, changing MySQL's default settings for fulltext index querying is completely undoable and unrealistic, so...
6
1651
by: Ja NE | last post by:
I'm trying to write a search script for my site. basic serch is fine, I can search for some word in one or other or third table, column... no problem, but now I would like to serch for name and family name of rtegistered users. so I need to search in more than one table. for one or two or even more words (imagine you are looking for Jan Michael Bellay) do I need query with AND... o.k., here is what I have done so far: $search = $_POST...
3
2171
by: Oliver Saunders | last post by:
I was really shocked not to find this already submitted by someone in the PHP manual notes. <? function jnWordCount($text) { $results = array(); $pattern = '/+\S+/'; // matches wordy characters and numbers preg_match_all($pattern,trim($text),$results); return count($results); }
4
5226
by: Peter Münster | last post by:
Hello, str_word_count() does not seem to work with locale "fr_FR.utf8". The output of the following script is string(10) "fr_FR.utf8" Array ( =bi =re ) I think, that "bière" should be recognized as word. Here is the test-script:
2
1515
by: Jeff Gardner | last post by:
Greetings: I am attempting to split an input string using the str_word_count function to return multiple single word query variables. I can create an array based on $search=(str_word_count($search, 1, '0123456789')); (I want words and/or numbers). I can extract named variables from the resulting array via $search=extract($search, EXTR_PREFIX_ALL, search); and then call each variable by
3
4870
by: ashok | last post by:
Hi, I need a function that will divide text from mysql in 2 parts, so that I can display first half in one column and second half in second column. I can't find what function will do this job. Here is part of what I have. $myrow = mysql_fetch_assoc($rsindexpage); //function wordcount $wc = str_word_count($myrow); $half = ($wc/2);
2
2189
by: David | last post by:
Hi, Could PHP be used to take a txt file (or set of txt files) and add a string of characters every X number of words or characters? Say a txt file with 50,000 characters/5,000 words how would you go about adding a string of characters every 5,000 characters or 500 words. To improve on this I'd want to if using characters as the guide to use
2
1185
by: spwpreston | last post by:
hello, i am trying to count all of the words in a string, and am trying to determine the best data structure for this. i would like to be able to do something like $arr_text = explode(" ", $text); then, i want to count each unique word in $arr_text
0
10237
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10071
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9882
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7431
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6690
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5326
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5467
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3589
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2832
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.