Re: Using Optional Dependencies... ???
| From: | Ian Eure | Date: | Mon, 12 Apr 2004 02:48:09 +0000 |
| Subject: | Re: Using Optional Dependencies... ??? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27433@lists.php.net to get a copy of this message | ||
On Sunday 11 April 2004 04:56 pm, Davey wrote:
> Hey all,
>
> I have a query about how exactly to code optional dependencies...
>
> I use this:
>
> @include_once 'XML/Beautifier.php';
>
> if (in_array('xml_beautifier',get_declared_classes())) {
> $beautifier = new XML_Beautifier;
> $code = trim($beautifier->formatString($code));
> }
>
You can use class_exists() after the include call, which is cleaner than the
in_array() check.