PHP Transform Assocative Assocative Array to Array
$array = array_values($array);
Esternome
$array = array_values($array);
<?php
$a = array("foo", "bar");
$aa = array();
foreach ($a as $idx => $val) {
$aa[$val] = $idx + 1;
}
print_r($aa);
?>
Array
(
[foo] => 1
[bar] => 2
)
Array
(
[foo] => 0
[bar] => 1
)
<?php
$a = array("foo", "bar");
$aa = array_flip($a);
print_r($aa);
?>