In this page we will learn about PHP Array. We will also understand how to use PHP Array in your PHP program. The PHP Array is very useful in developing PHP based applications.
PHP Arrays are ordered map which is used to stored values in key value pair. Here is simple example of PHP array:
$fruit_array[0] = "Apple";
$fruit_array[1] = "Banana";
$fruit_array[2] = "Pine Apple";
$fruit_array[3] = "Mango";
$fruit_array[3] = "Pear";
To print the value of stored at index 3 you can use following code:
<? echo $fruit_array[2] ?>
Following code shows how to create simple array:
// Create a simple array.
$my_array = array(1, 2, 3, 4, 5,6,7,8);
You can also create using following code:
$a = array(1 => 'one', 2 => 'two', 3 => 'three');
Check more at PHP Tutorials Index.
More Tutorials on roseindia.net for the topic PHP Array.If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions.