I wanted to save this array:
$words = array ("close","fed","house");
into :
$words_assoc = array (21=>"close",13=>"fed",15=>"house");
What is the relationship between the keys and values in the $words_assoc array?
You give so little info, it's very difficult to know how you want to achieve this. However, if you have an array of keys and an array of values, you can do this:
$words = array("close","fed","house");
$keys = array(21,13,15);
$words_assoc = array_combine($keys, $words);
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.