0

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 ?

1
  • I've not benchmarked it, but I would imagine it's extremely marginal amounts taken by aliasing (using use). Not worth worrying about. Commented Feb 11, 2014 at 15:11

1 Answer 1

1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.