-2

class SwiftMailerTestCase extends \PHPUnit_Framework_TestCase

why coder uses backslash in extends class in above php code

zahid
  • 23
  • 2

1 Answers1

2

It is used to let PHP know where the class exists. For example, \app\classes\TestClass will let it know that the class exists in app\classes directory/namespace. If you will not add the path, It will look for the class in the same Namespace!

Adarsh Sojitra
  • 2,059
  • 1
  • 27
  • 50