PHP String Functions

PHP String Functions

The PHP String Functions allow you to manipulate and access Strings. PHP supports a lot of inbuilt functions which are very helpful. These functions are a part of PHP core and there is no need to install them separately.

Articles

PHP addslashes is an inbuilt function in PHP. It escapes a string after adding backslashes in front of pre-defined characters. Also, it does not take any specified character as input. You can un-quote a string using the PHP stripslashes Function. The pre-defined character are: Single Quote (').Double Quotes (")Backslash (\)NULL ...
Read More
PHP chop is an inbuilt function in PHP. It removes whitespaces (or other characters) from the end of a string. In this article, we will discuss the PHP chop Function. Also, this function is an alias of PHP rtrim Function. Related Articles: PHP trim Function: Remove Characters from both Left ...
Read More
PHP chunk_split is an inbuilt function in PHP. It splits the input string into smaller chunks of the specified length. In this article, we will discuss the PHP chunk_split Function. Also, we will discuss a few examples of using it. Syntax string chunk_split($string, $length = 76, $end = "\r\n") Parameters ...
Read More
PHP implode Function is an inbuilt function of PHP. It joins elements of an array into a single string. It returns a string containing elements of the array. In this article, we discuss the PHP implode Function. Also, we will discuss a few examples demonstrating the usage of this function ...
Read More
The PHP lcfirst is an inbuilt function in PHP. It takes a string as the parameter and converts the first character lowercase. Also, it doesn't change other characters of the string. In this article, we will discuss the PHP lcfirst Function. Also, we will discuss a few examples of using ...
Read More
PHP ltrim is an inbuilt function in PHP. It removes whitespaces (or other characters) from the beginning of a string. In this article, we will discuss the PHP ltrim Function. Also, we will discuss a few examples of using it. Related Articles PHP trim Function: Remove Characters from both Left ...
Read More
PHP rtrim is an inbuilt function in PHP. It removes whitespaces (or other characters) from the end of a string. In this article, we will discuss the PHP rtrim Function. Also, we will discuss a few examples of using it. Related Articles: PHP trim Function: Remove Characters from both Left ...
Read More
PHP str_repeat is an inbuilt function in PHP. It repeats a string for a specified number of times. Both the string and the number are the arguments to the function. In this article, we will discuss the PHP str_repeat Function. Also, we will discuss a few examples of using it ...
Read More
PHP str_replace Function is an inbuilt function in PHP. It replaces all the occurrences of a string or an array of string in another string or an array of string respectively. In this article, we will discuss the PHP str_replace Function. Also, we will discuss a few examples of using ...
Read More
PHP str_shuffle is an inbuilt function in PHP. It randomly shuffles all the characters of the input string without altering the original string. Also, it also works on numbers by treating them as strings. It returns a string which is one of the permutations of characters of the input string ...
Read More
PHP strchr is an inbuilt function in PHP. It finds the first occurrence of a string in another string. Also, it returns the rest of the string after the first occurrence. In this article, we will discuss the PHP strchr Function. Note: This function is an alias of PHP strstr ...
Read More
PHP strcmp is an inbuilt Function in PHP. It compares two strings in a case-sensitive manner. Therefore, it treats lowercase and uppercase strings differently. The function compares and tells us if one string is greater, smaller or equal to the other string. In this article, we will discuss the PHP ...
Read More
PHP stripos is an inbuilt function in PHP. It returns the position of the first occurrence of one string in another. It is very helpful in determining if a string exists in another string. In this article, we will discuss the PHP stripos Function. Also, we will discuss a few ...
Read More
PHP stripslashes is an inbuilt function in PHP. It removes backslashes from a string. You can use it recover the original string after escaping it using PHP addslashes Function. In this article, we will discuss the PHP stripslashes Function. Syntax stripslashes($string) Parameters The function expects only one parameter as shown ...
Read More
PHP stristr is an inbuilt function in PHP. It finds the first occurrence of a string in another string. Also, it returns the rest of the string after the first occurrence. In this article, we will discuss the PHP stristr Function. Also, we will discuss a few examples of using ...
Read More
PHP strlen is an inbuilt Function in PHP. It takes a string as parameter and returns it's length. Also, it calculates the length by including all whitespaces and special characters in the string. In this article, we will discuss the PHP strlen Function. Also, we will discuss a few examples ...
Read More
PHP strpos is an inbuilt function in PHP. It returns the position of the first occurrence of one string in another. It is very helpful in determining if a string exists in another string. In this article, we will discuss the PHP strpos Function. Also, we will discuss a few ...
Read More
PHP strrchr is an inbuilt function in PHP. It finds the last occurrence of a character in a string and returns all characters till the end of the string. In this article, we will discuss PHP strrchr Function. Also, we will discuss a few examples of using it. You can ...
Read More
PHP strrev is an inbuilt function in PHP which reverses the input string. It takes a string in the parameter and returns the reverse of that string. In this article, we will discuss the PHP strrev Function. Also, we will discuss a few examples of using it. Syntax strrev ($input_string); ...
Read More
PHP strrpos is an inbuilt function in PHP. It returns the position of the last occurrence of one string in another. It is very helpful in determining if a string exists in another string. In this article, we will discuss the PHP strrpos Function. Also, we will discuss a few ...
Read More
PHP strstr is an inbuilt function in PHP. It finds the first occurrence of a string in another string. Also, it returns the rest of the string after the first occurrence. In this article, we will discuss the PHP strstr Function. Also, we will discuss a few examples of using ...
Read More
PHP strtolower is an inbuilt function in PHP. It converts a PHP string to lowercase characters. In this article, we will discuss this function. Also, we will discuss a few examples of using it. Also, you can convert a string to uppercase characters using PHP strtoupper Function. Syntax strtolower ($string) ...
Read More
PHP strtoupper converts a PHP string to uppercase characters. In this article, we will discuss the PHP strtoupper Function. Also, we will discuss a few examples of using it. Also, you can convert a string to lowercase characters using PHP strtolower Function. Syntax strtoupper ($string) Parameters The strtoupper function expects ...
Read More
PHP substr is an inbuilt function in PHP which returns sub-string from a string. It is a very handy function for extracting a part of the string. In this post, we learn about the PHP substr function along with various examples. Syntax substr($string, $startIndex, $stringLength); Parameters The PHP substr function ...
Read More
PHP trim is an inbuilt function in PHP. It removes whitespaces (or other characters) from both the left and right sides of a string. In this article, we will discuss the PHP trim Function. Also, we will discuss a few examples of using it. To remove characters only from left ...
Read More
The PHP ucfirst is an inbuilt function in PHP. It takes a string as the parameter and converts the first character uppercase. Also, it doesn't change other characters of the string. In this article, we will discuss the PHP ucfirst Function. Also, we will discuss a few examples of using ...
Read More