PHP String

PHP String-

PHP String: A string is a sequence of characters like “Welcome!”

Get The Length of a String
The PHP strlen () function returns the length of a string.
PHP String
Example

output:

Count The Number of Words in a String
The PHP str_word_count() function counts the number of words in a string:

Example

Output:

Reverse a String
The PHP strrev() function reverses a string:

Example

Output:

The Search For a Specific Text Within a PHP String 
The PHP strpos() function searches for a specific text( which you want to write text) within a string.

If a match is found, the function returns the character position of the first match. If no match is found, it will return FALSE.

Example

Output:

 

Replace Text Within a String

In PHP str_replace() function is used to replaces some characters with some other characters in a string.

Example

Output:

 

Resource
PHP.net