Chapter 5. Using Strings

I l @ ve RuBoard

As introduced in Chapter 2, Variables, the second category of variables is strings ” a collection of characters enclosed within either single or double quotation marks. A string variable may consist of a single letter, a word, a sentence , a paragraph, or even a jumble of nonsensical letters , numbers , and symbols (which might represent a password). Strings may be the most common variable type used in PHP.

Passwords, names , e-mail addresses, comments and similar input from HTML forms all become strings in your PHP script as you witnessed when using your form.html and HandleForm.php pages in Chapter 3, HTML Forms and PHP.

In this chapter, we will cover the most basic built-in functions PHP has for manipulating your string data, whether the string originates from a form or not. Some common techniques will be introduced here ”trimming strings, joining strings together, and extracting subsections of strings, although better uses for strings will be illustrated in the subsequent chapters.

I l @ ve RuBoard


PHP for the World Wide Web (Visual QuickStart Guide)
PHP for the World Wide Web (Visual QuickStart Guide)
ISBN: 0201727870
EAN: 2147483647
Year: 2001
Pages: 116
Authors: Larry Ullman

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net