O'Reilly logo

PHP and MySQL Recipes: A Problem-Solution Approach, Second Edition by Frank M. Kromann

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

© Frank M. Kromann 2016

Frank M. Kromann, PHP and MySQL Recipes, 10.1007/978-1-4842-0605-8_4

4. Working with Arrays

Frank M. Kromann

(1)Trabuco Canyon, California, USA

Arrays play a central role in PHP programming. Many functions return arrays and they are often used to handle configuration. The basic array is a list of key and value pairs where the key can be an integer or a string and the value can be any variable type, including arrays.

Recipe 4-1. Creating Arrays

Problem

Arrays are treated as a fundamental data type in PHP. There are no functions to call or objects that must be instantiated to create variables with array values.

Solution

PHP uses the language construct array() to create arrays. If you assign the value array() to a variable you create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required