php array

An array is traditionally defined as a group of items that share certain characteristics, such as similarity (car models, baseball teams, types of fruit, etc.) and type (e.g., all strings or integers). Each item is distinguished by a special identifier known as a key.

Array Syntax

array(key=>values)

Each item consists of two components: the aforementioned key and a value. The key serves as the lookup facility for retrieving its counterpart, the value. Keys can be numerical or associative. Numerical keys bear no real relation to the value other than the value's position in the array.

Array Example


<?php
$array_store=array("1"=>'wine',"2"=>"fish");
print_r($array_store);
?>

In the above example an array $array_store is maked with keys "1","2" and values "wine","fish".





Content