Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Strange error with using slash

I am using the PHP library for Sendgrid (https://github.com/sendgrid/sendgrid-php). Following the instructions, I had to use this line of code:

$mail = new SendGrid\Mail();

I get the error:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /home/d/public_html/ac/application/controllers/email.php on line 20

Parse error: syntax error, unexpected T_STRING in /home/d/public_html/ac/application/controllers/email.php on line 20

Is there something wrong with using '\'? Seems strange to me... How can I get this to work?

like image 209
Nyxynyx Avatar asked Jan 26 '26 10:01

Nyxynyx


1 Answers

That \ is part of namespaces, a new feature in PHP 5.3.

like image 107
Jeroen Avatar answered Jan 28 '26 22:01

Jeroen



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!