Re: Is "gd" present?

From: Date: Thu, 05 Jun 2003 12:29:46 +0000
Subject: Re: Is "gd" present?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-150337@lists.php.net to get a copy of this message
> > > $gd_loaded = (extension_loaded('gd'))?1:0; > > > > Well, this also fails the simple-as-possible test: if the value returned by > > extension_loaded() can be used to drive the ?: operator, it must be > > evaluable as a Boolean; this means you can use it directly for later use in > > an if() or similar context: > > > > $gd_loaded = extension_loaded('gd'); > > > > (And, indeed, a quick look at the manual reveals that extension_loaded > > returns a bool, which is exactly what you want without any further ado.) > > Thats true, but its more overhead calling a function than compare a variable. > Thats why i want to calll the function only once. Umm... the function is only called once in both examples... ---John Holmes...

« previous php.general (#150337) next »