Is there any way to check before adding namespaces to the script that can be run on php 5.2 server?
For example, if you want to use the doctrine (which requires 5.3) on server 5.3 and fall back to the PDO on server 5.2.
Example:
if($pdo){
}
else if($doctrine){
$classLoader = new Doctrine\Common\ClassLoader('Doctrine\Common');
$classLoader->register();
}
This is just an example, I'm sure I can make it work without namespaces, but it's just interesting if there is any use for them in the IF statement.
source
share