Forum Moderators: coopster
second array is the whole text to display for user:
$names = array("user_id"=>"Id of the user", "vname"=>"Vorname", "sname"=>"Surname", "tbl_name"=>"Name of the table");
What I need is to merge somehow these tables. Table sort is generated by the user and may only incorporate from 1 to 8 fields
I need the output array to be corresponding to both of them:
$output = array("vname"=>"Vorname", "sname"=>"Surname");
however I don't know how to do that. At first I thought, that $output = $names[$sort]; will do the thing,m but it didn't. I couldn't also find anything at www.php.net , however function array_map looks promising, but it makes an array of results' arrays (I want just one level).
Thanks for any answer
Michal Cibor
$sort = array("vname", "sname");
$names = array("user_id"=>"Id of the user", "vname"=>"Vorname", "sname"=>"Surname", "tbl_name"=>"Name of the table");
$output = array();
foreach ($sort as $keyname) {
$output[$keyname] = $names[$keyname];
}
You might want to check for the validity of $names[$keyname] depending on your setup.
Hope this is it.
Tim