I want to invert my array, can I do this?
<?php
$values = array("Fred","Bob","George");
print_r($values);
$values = array_flip($values);
print_r($values);
?>
Which returns:
Array
(
[0] => Fred
[1] => Bob
[2] => George
)
Array
(
[Fred] => 0
[Bob] => 1
[George] => 2
)
Comment on this Question and Answer >>>
ASK A QUESTION
More arrays PHP Questions
How do I add to the end of an array and know how large the array is?im getting a Resource id #5 $rs_comp = mysql_query("select * from company where autoID='$row_settings[compid]'");
How to get most repeated value in an array?
how a values entered in an array from keyboard?
I am not interested in the values in the arrays, how can I discard them?
