array_values: Return all the values of an array : Associate Array « Data Structure « PHP






array_values: Return all the values of an array

<?php
   $population = array("Ohio" => "11,421,267", "Iowa" => "2,936,760");
   $popvalues = array_values($population);
   print_r($popvalues);
   // Array ( [0] => 11,421,267 [1] => 2,936,760 )
?>

           
       








Related examples in the same category

1.Use foreach, while and list to loop through associate array
2.Sort associate array
3.array_key_exists
4.array_keys: Return all the keys of an array
5.Arrays Using Associative Array Notation
6.Reference the assiciate array element
7.foreach statement is used to loop through an associative array
8.Associative Arrays
9.Looping Through an Associative Array with foreach
10.key: Fetch a key from an associative array
11.print_r: output associate array
12.array_intersect_assoc: Computes the intersection of arrays with additional index check
13.An array called $computers with numeric and string keys
14.An array called $vegetables with string keys
15.Argument Swapping
16.Array to object
17.Assigning and Comparing
18.Building an array of defaults
19.Creates an array with keys 'a', 'b' and 'c with values of 1, 2 and 3 as well as keys 0, 1 and 2 with values 'a', 'b', and 'c'
20.Creating Arrays
21.Creates an array that assigns keys 1 through 7 to the days of the week.
22.Creating a multidimensional array
23.Creating an associative array of shapes
24.Obtaining Array Keys and Values
25.Obtaining Array Keys with a Given Value
26.One-based array index
27.Displaying one value from an array
28.Using both the array key and a passed-in value to modify each element value
29.Using Variable Variables to Create Associations