Technology, Web & Business Forum

You are here: Technology, Web & Business Forum : Web Development : Programming : PHP..how can I count how many characters are in a word in a paragraph


Welcome to the Technology, Web & Business Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.


Programming Discuss programming languages such as .NET, PHP, PERL, ASP, ColdFusion, C++


Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 03-28-2008
Junior Member
 
Join Date: Mar 2008
Posts: 2
Default PHP..how can I count how many characters are in a word in a paragraph

excluding whitespace? I want to be able to count how many characters are in a word excluding whitespace.
__________________
Powered by Yahoo! Answers
Reply With Quote
  #2 (permalink)  
Old 03-28-2008
Junior Member
 
Join Date: Mar 2008
Posts: 2
Default

Remove whitespace and count the length of the resulting string:

$text = "The quick brown fox";
$non_space = preg_replace("/\s+/", "", $text);
$char_count = strlen($non_space);
__________________
Powered by Yahoo! Answers
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT -5. The time now is 09:49 AM.