Re: Using Optional Dependencies... ???
| From: | Jon Parise | Date: | Mon, 12 Apr 2004 00:27:43 +0000 |
| Subject: | Re: Using Optional Dependencies... ??? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-27431@lists.php.net to get a copy of this message | ||
On Sun, Apr 11, 2004 at 07:56:33PM -0400, Davey wrote:
> 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));
> }
>
> I can think of no other way to do it...
You can also do it this way:
if ((@include_once 'XML/Beautifier.php') !== false) {
...
}
--
Jon Parise (jon@php.net) :: The PHP Project (http://www.php.net/)