Chapter 4. Strings

Most data you encounter as you program will be sequences of characters, or strings. Strings hold people’s names, passwords, addresses, credit card numbers, photographs, purchase histories, and more. For that reason, PHP has an extensive selection of functions for working with strings.

This chapter shows the many ways to write strings in your programs, including the sometimes tricky subject of interpolation (placing a variable’s value into a string), then covers functions for changing, quoting, and searching strings. By the end of this chapter, you’ll be a string-handling expert.

Get Programming PHP, 3rd Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.