Re: 'Code Snippets' you couldn't live without

From: Date: Wed, 03 Nov 2004 18:43:33 +0000
Subject: Re: 'Code Snippets' you couldn't live without
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-201070@lists.php.net to get a copy of this message
On Thu, 4 Nov 2004 04:16:48 +1000, Murray @ PlanetThoughtful <lists@planetthoughtful.org> 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/

« previous php.general (#201070) next »