Re: Is "gd" present?
| From: | Svein Larsen | Date: | Thu, 05 Jun 2003 12:23:25 +0000 |
| Subject: | Re: Is "gd" present? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-150334@lists.php.net to get a copy of this message | ||
Thats true, but its more overhead calling a function than compare a variable.
Thats why i want to calll the function only once.
- Svein
On Thursday 05 June 2003 14:03, Ford, Mike [LSS] wrote:
> > -----Original Message-----
> > From: Svein Larsen [mailto:svein@custompublish.com]
> > Sent: 04 June 2003 16:22
> >
> > $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.)
>
> Cheers!
>
> Mike
>
> ---------------------------------------------------------------------
> Mike Ford, Electronic Information Services Adviser,
> Learning Support Services, Learning & Information Services,
> JG125, James Graham Building, Leeds Metropolitan University,
> Beckett Park, LEEDS, LS6 3QS, United Kingdom
> Email: m.ford@lmu.ac.uk
> Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211