about 5 years ago
Arrays are the sequential memory storage which holds the different elements of same type under a common name.
The arrays have key/value pair in which the key points to the value.
There are two types of arrays:
The Indexed arrays are the one in which the key are the numeric number which starts with 0 and gets incremented every time a new value inserted in the array.
The particular element can be pointed by its key index.
$days = array("Monday","Tuesday","Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
This can be written as :
$days = "Monday";
$days = "Tuesday";
$days = "Wednesday";
$days = "Thursday";
$days = "Friday";
$days = "Saturday";
$days = "Sunday";
In Associative Array we need to specify the key for each value. the key in the array may be numeric or not, If the key is numeric then it may not be in sequence.
$score = array("Janny"=>80, "Danny"=>90, "John"=>85);
$score["Janny"] = 80;
$score["Danny"] = 90;
$score["John"] = 85;
Note: The difference between Indexed and Associative array is in the way the key is specified.
The Multidimensional Array is the one when we need to store one or more arrays in one array.Like we can store the data from a table in a two-dimensional array.
lets see an example :
$colors = array
In the above the $colors is a multidimensional which stores the other arrays, to access those array elements we should use two indices to point these, the two indices are the rows and the columns.
Starting with Chrome version 45, NPAPI is no longer supported for Google Chrome. For more information, see Chrome and NPAPI (blog.chromium.org).
Firefox and Microsoft Internet Explorer are recommended browsers for websites using java applets.
Chrome Version Support
Are you sure, you want to delete this comment?
Terms of Service
| © copyright 2021 FindNerd.com. All rights reserved.
Sign up using