Online
 
Friday, 09 January 2009
 
 
More article:
Related Content:

PHP Basic Arrays
 
Article Index
PHP Basic Arrays
Page 2
Page 3
Page 4
Page 5
Page 6
Page 7
Page 8
Page 9
Page 10
Page 11
Page 12
Page 13
Page 14

In PHP (and unlike most other programming languages that implement them) arrays are a means of grouping any number of different variables, regardless of type, into a single variable. Technically, arrays actually represent an ordered map that maps key values to pieces of variable data (see ). The contents of a value pointed to by a key in an array can be anything represented by a PHP variable; there is no limit (other than memory) imposed on the maximum number of different keys a single array can possess. There are a number of ways to declare arrays, each of which is discussed in the sections that follow.

Array Syntax

In PHP, you can create an array variable in various ways. Perhaps the simplest way to implement arrays is through the following syntax:

$variable[<key expr>] = <expr>;

<key expr> is an expression that evaluates to a string or any non-negative integer, and <expr> represents the expression whose value will be associated with the key. is an example of an array $foo, which contains four keys, a, b, c, and d, assigned the integer values 1, 2, 3, and 4, respectively:


Tags: Add more tags...,
This entry was posted on . You can follow any responses to this entry through the RSS 2.0 feed. You can leave a comment. Tags: Simple PHP, Pear, Easy PHP, PHP Tutorial, PHP MySQL, XSLT, Sap Tutorial, CSS Tutorial, XSL FO Java, SQL Tutorial.
Users' Comments (0)

Comment an article
  Name
  E-mail
   Title
Available characters: 4000
 Notify me of follow-up comments
This image contains a scrambled text, it is using a combination of colors, font size, background, angle in order to disallow computer to automate reading. You will have to reproduce it to post on my homepage
Enter what you see:

No comment posted

Wallpaper 33
Statistic


Last Post

 
Top! Top!