Defining Arrays

Arrays in PHP may be defined by two types of patterns: defining and assigning one element at a time; or declaring, which includes a definition and initial assignment of one to many elements. Both approaches are possible because PHP arrays are associative arrays and therefore not defined by a fixed-size allocation of elements. You will learn how to use both approaches in this section.

Before you explore arrays, there is another predefined PHP function that you should learn, the print_r() function. The print_r() function does two things: it prints the content of PHP arrays as name and value pairs; and it returns a Boolean true value as the default behavior. When the optional second argument is set to true, it prints nothing but ...

Get Oracle Database 10g Express Edition PHP Web Programming 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.