My question is rather simple. I wonder if in php, declare namespaces even if they are not used slows php . example:
<? php
use \ Library \ class1;
use \ Library \ class2;
use \ Library \ class3;
$ c1 = new class1;
$ c2 = new class3;
/ * More code * /
?>
So is that having to declare the namespace class2 and not use, slows excecution of php ?
First of all, you're not "declaring a namespace", you're aliasing a class name. And yes, it of course takes some minimal amount of processing power to be processed, but it's going to be virtually impossible to find any actual slowdown that this causes at any point. You'd have to have billions of those to make any dent.