PHP error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM (::) — what does it mean?
Hi everyone! I just started learning PHP and encountered a strange error that I can't understand. I'm trying to call a static method from a class, but PHP gives:
```
Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM (::) in /home/user/project/index.php on line 10
```
Here's my code:
```php
```
I thought that to call a static method you need to use `ClassName::$methodName()`, but apparently I'm confusing something. If I remove the `$` before `add`, the error disappears and the code works. But I saw in the documentation that for static properties, `ClassName::$property` is used. Why doesn't this work for methods? And what does this strange T_PAAMAYIM_NEKUDOTAYIM even mean? I googled it — it's some Hebrew word. Please explain how to correctly call static methods and properties.
No answers yet.
Log in to leave an answer