Skip to main content
Submitted by admin on 24 May 2022

Array(A part of Data Structure)

 In any programming language an array is a collection of elements of any datatype.

Types of arrays

Broadly There are two types of arrays.

1. single dimensional array:  

 Single dimensional array stores a collection of similar type of data in a contiguous block of memory as a list. we access each data item using the index. By default index of array always start with 0.

example: $array =[1,2,3,4,5,6,7,8,9,10];

1.1 Numeric Array

1.2 Associative Array

 

2. multidimensional array

multidimensional array stores a collection of similar type of data in memory as a matrix or table  format with a number of rows and columns.

$array = [
['element1', 'element2'],
['element3', 'element4'],
];