On Fri, 2007-07-13 at 15:36 -0500, OD wrote:
> Hello,
> Is there any easy way to alter a key's name?
> 
> I would like to remove some underscores in the $_POST array keys.

<?php

foreach( $_POST as $key => $value )
{
    if( strpos( $key, '_' ) !== false )
    {
        $_POST[str_replace( '_', '', $key )] = $value;
        unset( $_POST[$key] );
    }
}

?>

I would suggest NOT removing the original key though and just have both.
To do so just comment out/remove the line that has unset().

Cheers,
Rob.
-- 
...........................................................
SwarmBuy.com - http://www.swarmbuy.com

    Leveraging the buying power of the masses!
...........................................................

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to