␡
- Listing of String Functions
- Using the String Functions
- Formatting Strings
- Converting to and from Strings
- Creating Arrays
- Modifying Arrays
- Removing Array Elements
- Looping Over Arrays
- Listing of the Array Functions
- Sorting Arrays
- Navigating through Arrays
- Imploding and Exploding Arrays
- Extracting Variables from Arrays
- Merging and Splitting Arrays
- Comparing Arrays
- Manipulating the Data in Arrays
- Creating Multidimensional Arrays
- Looping Over Multidimensional Arrays
- Using the Array Operators
- Summary
< Back
Page 20 of 20
This chapter is from the book
Summary
PHP gives you some great ways of working with data in strings and arrays. Both have many different functions available. Here's a summary of the salient points in this chapter:
- The many string functions do everything from searching strings to formatting them for display. Take a look at Table 3-1 for a refresher.
- The printf and sprintf functions format strings for display.
- The strstr function searches a string for a substring.
- The substr_compare function lets you compare strings.
- You access the items in an array by using a numeric or string index.
- PHP knows you're working with an array if you include [] after a variable's name.
- The unset function removes items from arrays.
- The foreach statement provides a great way of looping over arrays.
- The array functions do everything from merging arrays to searching them.
- You can sort arrays with the sort function.
- You can convert between strings and arrays using the PHP implode and explode functions.
- You can use the array_diff function to create a new array that holds the elements that are different between two arrays.
- You can create multidimensional arrays simply by using two array indexes in square brackets, [ and ].
That's it for our coverage of strings and arrays for the moment, both of which we'll see again throughout the book. Now it's time to turn to working with and creating functions in Chapter 4, "Breaking It Up: Functions."
< Back
Page 20 of 20