itxen
06-09-2010, 06:53 AM
Definition and Usage
array() creates an array, with keys and values. If you skip the keys when you specify an array, an integer key is generated, starting at 0 and increases by 1 for each value.
Example 1
<?php
$a=array("a"=>"Dog","b"=>"Cat","c"=>"Horse");
print_r($a);
?>
The output of the code above will be:
Array ( [a] => Dog [b] => Cat [c] => Horse )
Example 2
<?php
$a=array("Dog","Cat","Horse");
print_r($a);
?>
The output of the code above will be:
Array ( [0] => Dog [1] => Cat [2] => Horse )
visit us:
[SPAM REMOVED]
array() creates an array, with keys and values. If you skip the keys when you specify an array, an integer key is generated, starting at 0 and increases by 1 for each value.
Example 1
<?php
$a=array("a"=>"Dog","b"=>"Cat","c"=>"Horse");
print_r($a);
?>
The output of the code above will be:
Array ( [a] => Dog [b] => Cat [c] => Horse )
Example 2
<?php
$a=array("Dog","Cat","Horse");
print_r($a);
?>
The output of the code above will be:
Array ( [0] => Dog [1] => Cat [2] => Horse )
visit us:
[SPAM REMOVED]