There are two types of Array in PHP. They are:
1) Numeric Array
2) Associative Array
1) Numeric Array:
This kind of array use index number to retrieve data. An element can be added to this array without setting any index number. The index will be auto-incremented to that element.The indexing always starts from zero ( 0 ).
Example:
2) Associative Array :
This kind of array use string values to retrieve data. A string index should be provided while creating a new element in array. The main use of associative array is memoization.[Note: memoization is a technique to optimize performance and avoiding repeat of calculations which has been done once in previous results.]
Associative Array is useful for mapping data and searching.
No comments:
Post a Comment