answersLogoWhite

0


Best Answer

Numeric array has numbers(+integers) that represent the values

Associative array has strings that represent the values

User Avatar

Wiki User

11y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What is the difference between numeric array and associative array?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Math & Arithmetic

Meaing of Associative Array in PHP?

There are two types of arrays, associative arrays, and indexed arrays. Indexed arrays are where you access the items in order, for example $myArray[0] would be the first item in the array, $myArray[1] would be the second item, and so on. You can create an indexed array like this: $myArray = array("item1","item2","item3"); echo $myArray[0]; //item1 echo $myArray[2]; //item3 You can also set your own indexes: $myArray = array(0=>"item1", 1=>"item2", 5=>"number 5"); echo $myArray[0]; //item1 echo $myArray[2]; //null or doesnt exist, i cant remember You can also add items after using the square-brackets. If you include a number, that index is set, otherwise it just adds it to the end of the array. $myArray[9] = "set index 9"; $myArray[] = "add to the end of the array"; Associative arrays use strings instead of numbers. $colors = array("cat"=>"brown", "dog"=>"yellow", "fish"=>"purple"); echo $colors["cat"]; //brown echo $colors["fish"]; //purple And you can add more with the square-brackets again. $colors["camel"] = "green"; To loop through both types of arrays you can use a foreach loop, or to loop through indexed arrays you can get the length into a variable and a do normal for loop.


What is the difference between array and control array?

An array is a set of values that are logically related to each other, such as the number of students in each grade in a grammar school. An array allows you to refer to these related values by the same name and to use a number, called an index or subscript, to tell them apart. The individual values are called the elements of the array. They are contiguous from index 0 through the highest index value. A control array is a group of controls that share the same name type and the same event procedures. Adding controls with control arrays uses fewer resources than adding multiple control of same type at design time.


You have only one rectangular array and you are between the numbers 12 and 16 what number are you?

13...13x1.


How do you empty an array in PHP?

To empty an array in PHP you need to use the unset function like shown below: <?php $array = array('hello', 'hi', 'weee'); unset($array); // empty ?>


Can a prime number be made into an array?

Yes, a unit array.

Related questions

Difference between mysql fetch row and mysql fetch array in PHP?

Both return a row in a MySQL database and in most applications can be used interchangeably. The difference is that mysql_fetch_array has an extra argument called $result_type that allows the returned array to be associative (string keys) or numeric (the keys are 0..n). A mysql_fetch_array call with the numeric parameter is equivalent to mysql_fetch_row.


What is the difference between a numericial array and an associative array?

A numericial array is an array with keys made up of only integers. An associative array is an array with keys made up of anything that is not an integer. In some languages, it is possible to mix integer keys and non-integer keys into a mixed array.


What is an associative array?

An associative array is one of a number of array-like data structures where the indices are not limited to integers.


What is difference between key and index in php arrays?

A key is the name of a variable in an array ($array["key"]) and the index is the position it's at ($array = ["key" => 0], the index would be 0). Keys and indices are the same if the array is not associative though ($array = [true], the key holding the value true is named 0 and is at index 0).


Why numeric arrays do not end with a '0' in C programming language?

The value zero is a perfectly valid numeric array element in its own right. If we used the value zero to mark the end of a numeric array in the same way we use a null-terminator to mark the end of a string (a character array), we'd have no way of representing the value zero within the array itself. Thus when working with numeric arrays, we must keep track of the array length independently of the array.


What is the difference between array and string of array?

When we declare an array of characters it has to be terminated by the NULL , but termination by NULL in case of string is automatic.


Difference between vector and array list?

Vectors are thread safe but array lists are not. Hence array lists are faster than Vectors.


What is associative memory explain its advantage?

its also called content addressable memory .Content-addressable memory (CAM) is a special type of computer memory used in certain very high speed searching applications. It is also known as associative memory, associative storage, or associative array


What is the difference between Land Grid Array and Pin Grid Array?

One has pin in front, one has land


What is Difference between programmable logic array and programmable array logic?

Using and gate - pla is programmable while pal is fixed


What is the difference between a Magician and a Chorus Line?

A Magician has a cunning array of stunts ...........................................................................


What does square brackets mean?

It means indexing into an array. The array could be an array of built in primitive types or array of objects. The index must be a numeric value greater than or equal to 0.