Tag : substr function

How to remove character from a string?

Removing characters from a string is most common and frequent activities in PHP. Suppose, You have a long name, but your system does not allow to show more than 6 characters of your name. In this case, you need to keep only first 6 characters from your name. To solve this issue we use substr() function. – Solution to remove [...]

Simple trick to extract substrings from a string

Sometimes we need to extract a substring from a long string. Php provide a very flexible and powerful substr()function that allows you to extract a substring from a larger string. It takes three parameters: the string to be worked on, a starting index and an optional length. The starting index can be specified as either a positive integer that means [...]