Friday 11 December 2015

PHP String Functions

strlen() function
  The strlen() function returns the length of a string, in characters.
strtolower() Function
The strtolower() function converts a string to lowercase.
Strtoupper() Function
The strtoupper() function converts a string to uppercase.
ucwords() Function
The ucwords() function converts the first character of each word in a string to uppercase.
Ucfirst() Function
The ucfirst() function converts the first character of a string to uppercase.
implode() Function
The implode() function returns a string from the elements of an array.
Syntax:
implode(separator,array)
explode() Function
The explode() function breaks a string into an array.
Note: The "separator" parameter cannot be an empty string.
Syntax:
explode(separator,string)

htmlentities()
The htmlentities() function converts characters to HTML entities.
 

htmlspecialchars() Function
The htmlspecialchars() function converts some predefined characters to HTML entities.
The predefined characters are:
& (ampersand) becomes &
" (double quote) becomes "
' (single quote) becomes '
< (less than) becomes &lt;
> (greater than) becomes &gt;

md5() Function
It is used for securing any data.
strcmp() Function:
The strcmp() function compares two strings.
Syntax:
strcmp(string1,string2);