If you’re like most novice PHP developers, you probably have only a passing acquaintance with PHP’s string functions. Sure, you know how to print output to a Web page, and you can probably split strings apart and glue them back together again. But there’s a lot more to PHP’s string toolkit than this: PHP has more than 175 string manipulation functions, and new ones are added on a regular basis.
Ever wondered what they were all for?If you have, you’re going to be thrilled with the listings in this chapter. In addition to offering you a broad overview of PHP’s string manipulation capabilities, this chapter discusses many other tasks commonly associated with strings in PHP— removing unnecessary whitespace, finding and replacing string patterns, counting and extracting string segments, identifying duplicate words, encrypting text and generating string passwords.
Along the way, you’ll find out a little more about those mysterious string functions, and also learn a few tricks to help you write more efficient code.