Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Section A.6. Chapter 6 Answers

A.6. Chapter 6 Answers


Question 6-1

A numeric array can be indexed numerically using numbers or numeric variables. An associative array uses alphanumeric identifiers to index elements.


Question 6-2

The main benefit of the array keyword is that it enables you to assign several values at a time to an array without repeating the array name.


Question 6-3

Both the each function and the foreach...as loop construct return elements from an array; both start at the beginning and increment a pointer to make sure the next element is returned each time; and both return FALSE when the end of the array is reached. The difference is that the each function returns just a single element, so it is usually wrapped in a loop. The foreach...as construct is already a loop, executing repeatedly until the array is exhausted or you explicitly break out of the loop.


Question 6-4

To create a multidimensional array, you need to assign additional arrays to elements of the main array.


Question 6-5

You can use the count function to count the number of elements in an array.


Question 6-6

The purpose of the explode function is to extract sections from a string that are separated by an identifier, such as extracting words separated by spaces within a sentence.


Question 6-7

To reset PHP’s internal pointer into an array back to the first element, call the reset function.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial