PHP String Functions

String Functions in PHP
String Functions in PHP

All these functions are used to manipulate strings. They are part of the PHP core, so you don't have to install anything to use these functions.

Read More

How To Remove Whitespace Characters in a string in PHP - trim() Function
How To Remove Whitespace Characters in a string in PHP - trim() Function

Many times, the strings have extra spaces that need to be removed. For example, you might want to replace multiple spaces with a single space or you might want to get rid of all the whitespace in a string. Similarly, you might be planning on stripping all the whitespace from either the left or the right end of a string.

Read More

How To Find First Occurrence in String - strstr() and stristr() Function
How To Find First Occurrence in String - strstr() and stristr() Function

The strstr() function and stristr() function can find the first occurrence of a substring (second parameter) inside another string (first parameter), and return all characters from the first occurrence till the end of the string.

Read More

How To Find String Length in PHP - strlen() Function
How To Find String Length in PHP - strlen() Function

The strlen() function returns the length of a given string. It returns 0 if the string is empty.

Read More

How To Find Part of String - substr() Function
How To Find Part of String - substr() Function

The substr() function returns a part of a string.

Read More

How To Split String In PHP Using Delimiter - explode() Function
How To Split String In PHP Using Delimiter - explode() Function

The explode() function in PHP is used to split a string into multiple strings based on the specified delimiter. It is similar to the split function in Perl.

Read More