Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Backslash in PHP -- what does it mean?

Tags:

php

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.

like image 757
Kyle Cureau Avatar asked May 28 '12 17:05

Kyle Cureau


People also ask

What does backslash mean in PHP?

\ (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.

What does ?: Mean in PHP?

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.

What is the use of Addslashes in PHP?

The addslashes() function returns a string with backslashes in front of predefined characters. The predefined characters are: single quote (') double quote (")

What is Stripslashes PHP?

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.


1 Answers

It's because they're using PHP namespaces. Namespaces are new as of PHP 5.3.

like image 100
ashurexm Avatar answered Oct 02 '22 12:10

ashurexm