-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Parse error: syntax error, unexpected token "use" #3017
Comments
A syntax error on that means that you're not using PHP 8.2, but something very old that doesn't support namespaces, which were introduced in PHP 5.3. I suggest you write a script containing |
Ive double checked it: Same as before....
|
This isn't something specific to PHPMailer. Try seeing if PHP gives you an error if you ask it to run this:
That's a simple |
There is nothing and No errors. |
OK, so now add the original lines back in, one at a time, until the problem starts happening. |
My guess... Switch the order of the "require" and "use" lines.
|
No, that won't help. Use statements are just local aliases, the require statements have no effect on them. They only come into play when you instantiate a class. |
theres is no change
same... |
Two questions:
it should be
Maybe its good to provide you full file, since it seems to be a overall syntax error |
I'll check it on tuesday, because my files are in the office ^^ |
So, what's the verdict? |
Hello,
|
And what happens when you put the "use" and "require" lines on the top of your file, so as the first lines?
|
It seems this works. |
You're welcome! |
Hi - i got these error in the php_error_log:
PHP Parse error: syntax error, unexpected token "use" in /opt/lampp/htdocs/....
The site isnt loading properly and i used only your snippet:
I use xampp on linux to test something with php version 8.2.12
The text was updated successfully, but these errors were encountered: