Download Document 7760007

yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Document related concepts

Object-relational impedance mismatch wikipedia, lookup

Microsoft SQL Server wikipedia, lookup

Clusterpoint wikipedia, lookup

Open Database Connectivity wikipedia, lookup

Relational model wikipedia, lookup

Database model wikipedia, lookup

Getting Started with PHP
An array is a special kind of variable that contains multiple values. If you think
of a variable as a box that contains a value, then an array can be thought of as a
box with compartments, where each compartment is able to store an individual
The simplest way to create an array in PHP is with the built-in array function:
$myarray = array('one', 2, 'three');
This code creates an array called $myarray that contains four values: 'one', 2,
and 'three'. Just like an ordinary variable, each space in an array can contain
any type of value. In this case, the first and third spaces contain strings, while
the second contains a number.
To get at a value stored in an array, you need to know its index. Typically, arrays
use numbers, starting with zero, as indices to point to the values they contain.
That is, the first value (or element) of an array has index 0, the second has index
1, the third has index 2, and so on. In general, therefore, the index of the nth
element of an array is n-1. Once you know the index of the value you're interested
in, you can get that value by placing the index in square brackets following the
array variable name:
// Outputs "one"
// Outputs "2"
// Outputs "three"
You can also use the index in square brackets to create new elements, or assign
new values to existing array elements:
$myarray[1] = 'two';
$myarray[3] = 'four';
// Assign a new value
// Create a new element
You can add elements to the end of an array by using the assignment operator
as usual, except with empty square brackets following the variable name:
$myarray[] = 'the fifth element';
// Outputs "the fifth element"
Array indices don't always have to be numbers; that is just the most common
choice. You can also use strings as indices to create what is called an associative
array. This type of array is called associative because it associates values with
meaningful indices. In this example, we associate a date with each of three names: