Hosted by Dailymotion. For legal issues report at the Copyright Center, report us on DMC, or use the Instant Removal tool.
PHP MYSQL LESSON 6 ( PART 1 ) _ ARRAY IN PHP
7 Views • Dec 16, 2017
Description
An array in PHP is actually an ordered map. A map is a type that associates values to keys. This type is optimized for several different uses; it can be treated as an array, list (vector), hash table (an implementation of a map), dictionary, collection, stack, queue, and probably more. As array values can be other arrays, trees and multidimensional arrays are also possible.
Explanation of those data structures is beyond the scope of this manual, but at least one example is provided for each of them. For more information, look towards the considerable literature that exists about this broad topic.
Syntax ¶
Specifying with array() ¶
An array can be created using the array() language construct. It takes any number of comma-separated key => value pairs as arguments.
array(
key => value,
key2 => value2,
key3 => value3,
...
)
The comma after the last array element is optional and can be omitted. This is usually done for single-line arrays, i.e. array(1, 2) is preferred over array(1, 2, ). For multi-line arrays on the other hand the trailing comma is commonly used, as it allows easier addition of new elements at the end.
As of PHP 5.4 you can also use the short array syntax, which replaces array() with [].
Example #1 A simple array
More from User
Almond Butter Recipe
Akash Jangra
PHP MYSQL LESSON 7 ( PART 1 ) _ LOOPS IN PHP
Akash Jangra
PHP MYSQL LESSON 6 ( PART 2 ) _ ARRAY IN PHP
Akash Jangra
PHP MYSQL LESSON 6 ( PART 1 ) _ ARRAY IN PHP
Akash Jangra
PHP MYSQL LESSON 5 (Part 1) _ OPERATORS IN PHP
Akash Jangra
PHP MYSQL LESSON 5 ( Part 2 ) _ OPERATORS IN PHP
Akash Jangra
Related Videos
Read PHP MySQL Web Programming Interview Questions Answers and Explanations: PHP MySQL FAQ
Boesen
Just Enough Web Programming with XHTML PHP and MySQL
Jamesgoff
Web Development with PHP &MySQL Tutorial-7-Associative Array in PHP
WEB Development Trainer
Setting up a VPS for web hosting. How to Install LAMP, Apache, Mysql, PHP, phpmyadmin
panduanvps
Read Web Programming for Business: PHP Object-Oriented Programming with Oracle Ebook Free
Rmetz
Web Development with PHP &MySQL Tutorial-5-Index Arrays
WEB Development Trainer