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
)
More arrays PHP Questions
How can I check if a value is already in an array?How do I remove the first element from an array?
How can I loop through the members of an array?
How do I write my own sort function?
How do I remove and view the last element of an array?