array_map help
| From: | Mark Steudel | Date: | Fri, 17 Feb 2006 16:36:00 +0000 |
| Subject: | array_map help | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-230643@lists.php.net to get a copy of this message | ||
I've got the following code and I am not doing something right. Either my
function is wrong, or the way Im using array_map is wrong, as slashes are
still making it into the data, and the asdf iosn't getting appended to each
value.
Thanks, Mark
// function to remove stripped slashes
function detectMGQ($value)
{
// Stripslashes
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
// added in to detect if this function is working
$value .= $value.'asdf';
return $value;
}
// construct field and value pairs into array
$field_values = array( 'name' => "$clean[name]",
'email' =>
"$clean[email]",
'username' =>
"$clean[username]",
'accesslevel' =>
"$clean[accesslevel]",
'status' =>
"$clean[status]",
'password' =>
base64_encode(rc4($clean[password1])) );
// walk through the values and strip out the slashses
$field_values = array_map( "detectMGQ", $field_values );