Answers for "how to convert simple array to associative array in php"

PHP
0

php transform associative array to array

$array = array_values($array);
Posted by: Guest on June-14-2020
1

convert array to associative array php

<?php
$a = array("foo", "bar");
$aa = array();
foreach ($a as $idx => $val) {
  $aa[$val] = $idx + 1;
}
print_r($aa);
?>
Posted by: Guest on March-06-2022

Code answers related to "how to convert simple array to associative array in php"

Browse Popular Code Answers by Language