PHP Tutorials - Manipulating Strings
Of all data types PHP supports, strings are probably the ones most often used. One of the reasons for this is that, at some point, a string representation of something is needed when sending out something to the client.
PHP offers a vast number of functions suitable for strings, almost 100. In addition, regular expressions come in handy when looking for certain patterns in strings. However, in real life only a fraction of these functions are actually used. Most of them deserve their loyal fan base; however, some underestimated functions should get more attention. The code in this tutorial offer a good mix of both: standard applications and rather unusual, but very useful ways to work with strings.
Table of content (tutorial index)
advertisement
Comparing Strings
Checking Usernames and Passwords
Converting Strings into Hypertext Markup Language (HTML)
Using Line Breaks
Encrypting Strings
Checksumming Strings
Extracting Substrings
Protecting Email Addresses Using ASCII Codes
Scanning Formatted Strings
Getting Detailed Information About Variables
Searching in Strings
Using POSIX Regular Expressions
Using Perl-Compatible Regular Expressions
Finding Tags with Regular Expressions
Validating Numbers (and Other Data Types)
Validating Email Addresses
Search and Replace