PHP Strings

PHP Strings

A string is a sequence of characters, numbers and special characters or combination of all.
Like $string = ‘Welcome to!!’;
we will learn some common functions to manipulate strings.

PHP String Functions

Length of a String –
strlen() function returns the length of a string.

Count Number of Words in a String –
str_word_count() function counts the number of words in a string.

Replace Particular Text in a Strings
str_replace() replaces all occurrences of the search text within the target string.

Reverse a String
strrev() function reverses a string.

php strings