In this blog, we will teach you about PHP ucwords() function. Basically we have also teach about basics of PHP 7 . so, you will go to our previous Blog for learn about PHP and for your kind information we also have a YouTube channel, which we continuously uploaded videos of HTML, CSS, PHP and Tech Videos. so please subscribe to our YouTube channel.
YouTube Channel :- Kumar Atul Jaiswal
PHP str_word_count () Function
The str_word_count() function is a built-in function in PHP and is used to return information about words used in a string like total number word in the string, positions of the words in the string etc. PHP str_word_count() Function
or
The PHP str_word_count() function counts the number of words in a string.
Syntax
str_word_count ( $string )
Below programs explain the working of str_word_count() function:
Calculating the number of words in a string: To Display only the number of words in a string,the str_word_count() function should be executed in the following way:
Example
<!DOCTYPE html>
<html>
<head>
<title> PHP str_word_count Function </title>
</head>
<body>
<h1> </h1>
<?php
$yourstring = "Twinkle twinkl4e little star";
<html>
<head>
<title> PHP str_word_count Function </title>
</head>
<body>
<h1> </h1>
<?php
$yourstring = "Twinkle twinkl4e little star";
echo str_word_count ( $yourstring );
echo "<br>";
echo "<br>";
$mystring = "The PHP str_word_count() function counts the number of words in a string.";
echo str_word_count ( $mystring );
echo "<br>";
5
14
NOTE :- Video on This Topic :- Soon
Have a Nice Stay Here : - )
0 comments:
Post a Comment
For Any Tech Updates, Hacking News, Internet, Computer, Technology and related to IT Field Articles Follow Our Blog.