Sponsored Content
The Lounge What is on Your Mind? Guido van Rossum resigns as Python Leader... Post 303020103 by Neo on Friday 13th of July 2018 08:54:28 AM
Old 07-13-2018
No good deed goes unpunished.
 

3 More Discussions You Might Find Interesting

1. Programming

Why process leader can not call setsid()

Why process leader can not call setsid() (2 Replies)
Discussion started by: chenhao_no1
2 Replies

2. UNIX for Dummies Questions & Answers

Generating key values for leader records

All, I have a file with text as shown below. I want the o/p file with generated values in the first column as shown in the o/p file. Pls note that the size of my file is 6 GB. How do i do this ? Input file 999999abcdef 999999ghijkl 999999mnopq 777777rosesarered 777777skyisblue Output... (1 Reply)
Discussion started by: ajfaq
1 Replies

3. What is on Your Mind?

Poster of the Year 2019 - Jeroen van Dijke

Today, I am very pleased to announce the Poster of the Year Award, 2019 is Jeroen van Dijke (Scrutinizer) Jeroen has been a member of unix.com just over 11 years (He first joined unix.com in November 2008) and has been a very valuable, reliable and thoughtful resource for countless people over... (3 Replies)
Discussion started by: Neo
3 Replies
STR_WORD_COUNT(3)							 1							 STR_WORD_COUNT(3)

str_word_count - Return information about words used in a string

SYNOPSIS
mixed str_word_count (string $string, [int $format], [string $charlist]) DESCRIPTION
Counts the number of words inside $string. If the optional $format is not specified, then the return value will be an integer representing the number of words found. In the event the $format is specified, the return value will be an array, content of which is dependent on the $format. The possible value for the $format and the resultant outputs are listed below. For the purpose of this function, 'word' is defined as a locale dependent string containing alphabetic characters, which also may contain, but not start with "'" and "-" characters. PARAMETERS
o $string - The string o $format - Specify the return value of this function. The current supported values are: o 0 - returns the number of words found o 1 - returns an array containing all the words found inside the $string o 2 - returns an associative array, where the key is the numeric position of the word inside the $string and the value is the actual word itself o $charlist - A list of additional characters which will be considered as 'word' RETURN VALUES
Returns an array or an integer, depending on the $format chosen. CHANGELOG
+--------+--------------------------------+ |Version | | | | | | | Description | | | | +--------+--------------------------------+ | 5.1.0 | | | | | | | Added the $charlist parameter | | | | +--------+--------------------------------+ EXAMPLES
Example #1 A str_word_count(3) example <?php $str = "Hello fri3nd, you're looking good today!"; print_r(str_word_count($str, 1)); print_r(str_word_count($str, 2)); print_r(str_word_count($str, 1, 'aaac3')); echo str_word_count($str); ?> The above example will output: Array ( [0] => Hello [1] => fri [2] => nd [3] => you're [4] => looking [5] => good [6] => today ) Array ( [0] => Hello [6] => fri [10] => nd [14] => you're [29] => looking [46] => good [51] => today ) Array ( [0] => Hello [1] => fri3nd [2] => you're [3] => looking [4] => good [5] => today ) 7 SEE ALSO
explode(3), preg_split(3), split(3), count_chars(3), substr_count(3). PHP Documentation Group STR_WORD_COUNT(3)
All times are GMT -4. The time now is 05:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy