$mail = new SendGrid\Mail();
I don't understand the meaning of \
in between SendGrid
and Mail()
above line.
can anybody tell me what it is and its logic.
That defines the namespace. So the Mail library is in the SendGrid namespace. This is a feature only available in PHP 5.3+.
Basically a namespace is a way to limit a scope within which you can have class names. It allows you to have classes with the same name in many different name spaces without collisions between the class definitions. It's great for writing libraries because it makes it so your library's end user is not constrained by your naming conventions.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With