Search Marketing

   
   

Creating an Array

Fri May 02, 2008 10:03 pm
<<     >>
Comments: 0 Views: 274

To create an array using PHP you first set a variable to become ready for an array of values.

There are multiple ways of setting an array variable with or without any data being set initially.

Here are two examples:

$x = array();
$x[] .= 1;
$x[] .= 2;
$x[] .= 3;

print_r ($x);

$y = array(1,2,3);

print_r ($y);

The examples above will produce the following:

From variable $x - Array ( [0] => 1 [1] => 2 [2] => 3 )


From variable $y - Array ( [0] => 1 [1] => 2 [2] => 3 )

You can now begin to add, move or remove items from these arrays.



Comments
Name:
*
URL: http: (ex. cnn.com)
Comment:
*
Number:
Math (28 + 3)
* required
SubCategories
Regular Expressions

© 2019 Christonium LLC

Christonium.com
|
Terms of Use
|
Privacy
ccc