Home / EG Comp Lab / PHP Strings

PHP Strings

A String is sequence of character like “Hello Microtech!!”.


PHP String Functions

In this chapter we will look at some commonly used functions to manipulate strings.


Get The Length of a String

The PHP strlen() function returns length of a string (number of character)


Count Number of word in a string

The PHP str_word_count() function counts number of words in a string.


Reverse a String

The strrev() function reverse a string.

Search for Specific text within a string

The PHP strpos() function search for specific text within a string.

Replace Text Within a String

The PHP str_replace() function replaces some characters with some other characters in a string.


[sam id=”4″ codes=”true”]


[message_box color=”yellow”]


echo strlen(“Hello Microtech!”);
echo “<br>”;
echo strrev(“Hello Microtech!”);
echo “<br>”;
echo str_word_count(“Hello Microtech!”);
echo “<br>”;
echo strpos(“Hello Microtech!”, “Microtech”);
echo “<br>”;
echo str_replace(“Microtech”, “Engineers”, “Hello Microtech!”);






About Utpal

I am third year student of computer engineering in L.D COLLEGE OF ENGINEERING,Ahmedabad.

Check Also

Game-Theoretic Pricing for Video Streaming in Mobile Networks

ABSTRACT Mobile phones are among the most popular consumer devices, and the recent developments of …

Leave a Reply

Be the First to Comment!

Notify of