PHP’s massive string manipulation library offers almost 100 native functions for dicing, splicing, parsing and searching text in every imaginable fashion. In fact, PHP has so many string manipulation options that determining the best approach for a particular string-related task can sometimes be difficult. In his PHPBuilder.com article, Jason Gilmore highlights the ideal PHP development solutions to the following 10 common string manipulation tasks.
- Determining the Length of a String
- Truncating Text to Produce a Summary
- Counting the Number of Characters and Words in a String
- Parsing a CSV File
- Converting an Array into a String
- Converting URLs into Hyperlinks
- Removing HTML Tags from a String
- Comparing Two Strings
- Converting Newline Characters to Break Tags
- Applying Wordwrap