On Thu, 4 Nov 2004 04:16:48 +1000, Murray @ PlanetThoughtful
<[EMAIL PROTECTED]> wrote:
> I'm curious to know what other members of the list think of as the code
> snippets they couldn't live without when working on a PHP project. IE, the
> kind of re-usable bits and pieces that make your life a lot easier.

function slashes( $var )
{
    if ( is_array( $var ) )
        return array_map( 'slashes', $var );
    else
        return addslashes( $var );
}

set_magic_quotes_runtime( 0 );
if ( get_magic_quotes_gpc() == 0 )
{
    $_GET = isset( $_GET ) ? array_map( 'slashes', $_GET ) : array();
    $_POST  = isset( $_POST ) ? array_map( 'slashes', $_POST ) : array();
    $_COOKIE = isset( $_COOKIE ) ? array_map( 'slashes', $_COOKIE ) : array();
}


-- 
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/

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

Reply via email to