I just saw the use of a backslash in a reference to a PHP object and was curious about it (I have never seen this before). What does it mean?
$mail = new SendGrid\Mail();
If you're curious, here's SendGrid's documentation.
\ (backslash) is the namespace separator in PHP 5.3. A \ before the beginning of a function represents the Global Namespace. Putting it there will ensure that the function called is from the global namespace, even if there is a function by the same name in the current namespace.
The Scope Resolution Operator (also called Paamayim Nekudotayim) or in simpler terms, the double colon, is a token that allows access to static, constant, and overridden properties or methods of a class.
The addslashes() function returns a string with backslashes in front of predefined characters. The predefined characters are: single quote (') double quote (")
Definition and Usage. The stripslashes() function removes backslashes added by the addslashes() function. Tip: This function can be used to clean up data retrieved from a database or from an HTML form.
It's because they're using PHP namespaces. Namespaces are new as of PHP 5.3.
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