Welcome to all our readers on our website at www.tutorialpath.com. As you all know that here on our website we will provide you lots of information related to the latest and newly introduced technology which help you to get updated with the latest tech. Here you will get all the useful information which is required in this tech world. As you know technology is one of the trending part in this world. So, here again we came up with a latest and new tech information which is related to the process of creating PHP Array . With the help of this article you will get to know the complete process of how to create PHP array in a step by step manner. So, simply have a look to this article and grab all the useful information which is going to be very helpful for you.
All the variables you have used have held only a single value.
An array is a special variable, which can hold more than one value at a time.
There are three types of array.
- Indexed Array : An array with a numeric index.
- Associative Array : Arrays with named keys.
- Nesting Array(Multi-D array) : An array containing one or more array.
How to define array
1.Indexed Arrays:- There are two ways to create of indexed array.
$cars = array(“VOLVO”,”TATA”,”BMW”);
$car’s = “VOLVO”;
$car’s = “TATA”;
$car’s = “BMW”;
- GET the length of an array – The count() function.
- The count() function is used to return the length (the number of elements) of an array.
2. Associative Arrays:-
- Associative arrays are arrays that use name keys that you assign to them.
- there are two ways to create an associative arrays.
$age = array(“peter”=>”35″,”Ben”=>”37”);
3. Multidimensional Arrays:-
- A multidimensional Arrays is an array containing one or more arrays.