You may not know this, but the latest version of PHP comes with avery powerful set of string manipulatation tools. This article takes anin-depth look at these tools and illustrates how they can save you time andeffort in your daily development activities.
If you're anything like me, your acquaintance with PHP's string functions is pretty limited. Sure, you know how to echo output to the screen, and you can even handle things like string concatenation and tokenization. But do you know how to format a string before inserting it into a database, or display decimals in a user-friendly format?
Well, fear not - over the next few pages, I'm going to be taking an in-depth look at the powerful string manipulation tools PHP gives you for free. I'm going to introduce you to the wonders of string concatenation and repetition, string reversal, string comparison, string search-and-replace operations, and string formatting...all in the next ten minutes.
You're probably wondering why you need to know this stuff. For most general development activities, you don't - echo() and print() will do just fine, so long as you're not planning on doing any serious string manipulation. But if you ever find yourself needing to slice and dice strings lengthwise in order to cook them into something completely different, you're going to be glad you read this article. As a PHP developer myself, I was elated to add some new and interesting weapons to my PHP armory while researching this article...and quite distressed that it had taken me so long to find them.
In addition to providing a gentle introduction to PHP programming in general (and PHP string manipulation in particular), this article will offer you a broad overview of PHP's string manipulation capabilities, serving as both a handy reference and a tool to help you write more efficient code. Regardless of whether you're new to PHP or if you've been working with the language for a while, you should find something interesting in here.