RE: [PHP] Is "gd" present?
| From: | Ford, Mike [LSS] | Date: | Thu, 05 Jun 2003 12:03:54 +0000 |
| Subject: | RE: [PHP] Is "gd" present? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-150331@lists.php.net to get a copy of this message | ||
> -----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