This will seem obvious to some, but if you need to preserve a duplicate key, being you have unique vars, you can switch the array_combine around, to where the vars are the keys, and this will output correctly.
This [default] formula auto-removes the duplicate keys.
$i=0;
foreach (array_combine($keys, $vars) as $key => $var)
{
$i=$i;
echo($key);
echo " ";
echo($var);
}
This formula accomplishes the same thing, in the same order, but the duplicate "keys" (which are now vars) are kept.
$i=0;
foreach (array_combine($vars, $keys) as $var => $key)
{
$i=$i;
echo($key);
echo " ";
echo($var);
}
I know, I'm a newbie, but perhaps someone else will need this eventually. I couldn't find another solution anywhere.