In this chapter, you have learned about 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 to create strings that both transform and format data. 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 the case of characters in a string with strtoupper(), strtolower(), or ucwords(). You can replace all instances of a string with str_replace().

You also learned how to use various PHP functions to perform date- and time-related actions. The time() function gets a date stamp for the current date and time, and you can use getdate() to extract date information from a time stamp and date() to convert a time stamp into a formatted string. You learned how to create a time stamp using mktime(), and how to test a date for validity with checkdate(). You will learn many more powerful date-related functions in Chapter 16, "Learning Basic SQL Commands"," so much so that you may find yourself using MySQL and not PHP for many of your date-related needs.

Sams Teach Yourself PHP, MySQL And Apache All in One
Sams Teach Yourself PHP, MySQL and Apache All in One (3rd Edition)
ISBN: 0672328739
EAN: 2147483647
Year: 2004
Pages: 327 © 2008-2017.
If you may any questions please contact us: