Sometimes I need to match fieldnames from database tables. But if a source field is used many times you can not use a hash "=>", because it overrides the key.
My approach is to use a comma separated array and use a while-loop in conjunction with each. Having that you can iterate key/value based, but may have a key multiple times.
$fieldmap = array
(
'id', 'import_id',
'productname', 'title',
'datetime_online', 'onlineDate',
'datetime_test_final', 'offlineDate',
'active', 'status',
'questionaire_intro', 'text_lead',
'datetime_online', 'createdAt',
'datetime_online', 'updatedAt'
);
while(list(,$key) = each($fieldmap))
{
list(,$value) = each($fieldmap);
echo "$key: $value\n";
}