PHP string functions

In previous php tutorial we learnt what is function and how to use function in php. In this  php tutorial we will learn some in-built string function. PHP supports many string functions but here we learn some important string function with an example.

PHP String functions

The string is a sequence of characters like “Meer academy”.
In php string can written with in (“) double quote or (‘) single quote.

There are some in-built php string function available for manipulation of string.

The main string function are:

PHP strlen() string function : The strlen() function used to returns the length of string.

PHP substr() string function : The substr() function used to returns some part of string.

PHP str_word_count() function : The str_word_count() used to returns the count of words in a string.

PHP strrev() string function : The strrev() used to returns reverses a string.

PHP strpos() string function : The strpos() function used to returns a position of specified character.

PHP str_replace() string function : The str_replace() function used to replace string with another string.

PHP str_repeat() string function : The str_repeat() function used to repeat word for specified number of times.

PHP empty() function : Check the string is empty or not.

PHP strcmp() function : The php strcmp() function used to compare two strings.

PHP trim() function : The php trim() function is used to remove whitespace and predefined character from both side of a string.

PHP strtolower() function : The strtolower() function used to converts string in to lowercase.

PHP strtoupper() function : The strtoupper() function used to converts string in to uppercase.

PHP ucwords() function : The php ucwords() function used to converts uppercase the first letter of each word of a string.

PHP ucfirst() function : The ucfirst() function used to converts in uppercase the first letter of a string.

 

Now, we will learn all php string function one bye one in next php tutorial.

Leave a Reply

Your email address will not be published. Required fields are marked *

7 + 9 =


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">