Summary

In this chapter, you have covered some of the functions that enable you to take control of the strings in your PHP scripts. You learned how to format strings with printf() and sprint(). You should be able to use these functions both to create strings that transform data and lay it out. You learned about functions that investigate strings. You should be able to discover the length of a string with strlen(), determine the presence of a substring with strpos(), or extract a substring with substr(). You should be able to tokenize a string with strtok().

You also learned about functions that transform strings. You can now remove white space from the beginning or end of a string with trim(), ltrim(), or rtrim(). You can change case with strtoupper() ...

Get Sams Teach Yourself PHP, MySQL® and Apache All in One now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.