Re: isset

From: Date: Mon, 16 Apr 2007 14:43:56 +0000
Subject: Re: isset
References: 1 2 3 4  Groups: php.general 
Request: Send a blank email to php-general+get-253006@lists.php.net to get a copy of this message
At 12:16 PM -0500 4/15/07, Larry Garfield wrote:
If you want your syntax to be a bit simpler, I frequently use helper functions along these lines: function http_get_int($var, $default=0) { return isset($_GET[$var]) ? (int) $_GET[$var] : $default; } if (http_get_int('var') ==5) { // Do stuff } Clean to read, easy defaults, (reasonably) type-safe, and E_NOTICE friendly.
Larry: Slick. Thanks, tedd -- ------- http://sperling.com http://ancientstones.com http://earthstones.com

« previous php.general (#253006) next »