Got the following error when importing a PEAR class (Validate) into my namespace
Cannot redeclare class Validate
In order to include a 3. part class without namespaces (like PEAR classes) into your namespace you can to do the following:
<?php namespace diversen; include_once 'Validate.php'; // to prevent Fatal error: // Cannot redeclare class Validate // use Validate as e.g. pearValidate; use Validate as pearValidate;
But is is much simpler to write:
use Validate Validate
When using the class!
This page has been viewed 5692 times. First hit: 30-Oct-2015 13:32:29
Share email, Google+, Twitter, Facebook.
comments powered by Disqus