Skip to main content

array


An array is the collection of elements an array is like a special variable which can hold more than one number or string at a time.array hold the key value of the data value.

example:

$arr_array = array(5,7,6,9,15);

in the above $arr_array is the name of array variable and array hold the index number of the given value.


type of array


In a php ,there are basically two type of an array.

1- Numeric array
2- Associative array

Numeric array


numeric arrays are those array in which the indexes are in numeric form.the key of an numeric array
are integer , begining at 0.

example

$arr_array(5,7,16,15,19);

in a example index 0 hold the value 5 , index 1 hold the value 7 and so on till the value.

Associative array


associative array are those array which have indeces in string and character form.

for example

$arr_array = array( 'english=>65, 'hindi'=>25, 'math'=>75);

In the above example the key is english,hindi and math that is hold the value.







Comments

Popular posts from this blog