Issue
Currently developing a Laravel app and a question came to mind. Is any "technical" difference between this two ways to use a class?
First way:
public function store() {
new \Illuminate\Auth\Events\Registered($user)
}
VS
Second way:
use Illuminate\Auth\Events\Registered;
public function store() {
new Registered($user)
}
- One way is more performant than the other?
- Is any difference in the way PHP reads this lines?
- When the class is only used once, is better to include it using first way or second way?
- Also any other this than comes to mind...
Solution
No difference in performance but its personal choice but if you are using the class more than once in the same class importing once works well and looks clean in my view
Answered By - Nishan Timsina
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.