iwato Posted June 11, 2017 Share Posted June 11, 2017 I would like to preserve the keys to the associative input array ($varnames) and replace the values with those of $_POST. This function replaces the both the keys and values and returns an index array with the $_POST values. function replace_value($a, $b) { $a = $b; return $a; }; $varnames = array_map(replace_value, $varnames, $_POST); print_r($varnames); Any suggestions? Roddy Link to comment Share on other sites More sharing options...
iwato Posted June 11, 2017 Author Share Posted June 11, 2017 Never mind unless, of course, you know something about array mapping that I do not and would like to teach me. Certainly I am willing to learn. For the moment, I have resolved the problem using the array_combine( ) method. Roddy Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now