New String Handling Techniques
Learn about new string functions that help edit the string at the beginning, middle, or end.
We'll cover the following...
Something PHP developers deal with on a constant basis is having to check for sets of characters that appear at the beginning, middle, or end of a string. The problem with the current set of string functions is that they are not designed to deal with the presence or absence of a substring. Rather, the current set of functions is designed to determine the position of a substring. This, in turn, can then be interpolated in a boolean manner to determine the presence or absence of a substring.
The problem with this approach is summarized in a famous quote attributed to Sir Winston Churchill:
“Golf is a game whose aim is to hit a very small ball into an ever smaller hole, with weapons singularly ill-designed for the purpose.”
Let’s now have a look at three ...