I have 2 PHP arrays, the first of which stores values, and the second of which stores keys, like so:
['first designer', 'shirt', 'cloth1', 'cloth2', 'second designer']['designer', 'brand', 'category', 'category', 'designer']
I’d like to transform these arrays so that I can output them in the following format, grouping items in the first array based on the respective element of the second array:
<div id="category">
cloth1
cloth2
</div>
<div id="brand">
shirt
</div>
<div id="designer">
first designer
second desinger
</div>
Try this:
This will output:
Codepad: http://codepad.org/T7NmPyVR