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 requested 6196 times