Static Method Not Working on Web Server in PHP
oop, php
Solution
If the exact same code is working locally, but gives a syntax error on a live server, you might be using different PHP versions (an old PHP4 version on the server, perhaps).
Problem
I just finished working on a site in `PHP` and decided to upload it unto my web server, but when I try to run pages with static method calls I get this error `Unexpected T_PAAMAYIM_NEKUDOTAYIM`. I know this has to do with double colon error, but I do not understand why it works on my local web server and refuses to work on my remote web server. Due to this error, I had to through my whole site converting all static methods to instance methods ``` <?php class User { private $userId; public function __construct() { if(func_num_args() == 1) { $this->userId = func_get_arg(1); } } public static function userNameExists($name) { global $dbc; if(gettype($name) != "string") { die("Invalid Function Parameter"); } $sql = "SELECT username FROM users WHERE users.username='$name'"; $result = mysqli_query($dbc, $sql) or die("Could Not Check Username at This Time: ".mysqli_error($dbc)); if(mysqli_num_rows($result) > 0) { return true; } else { return false; } } ?> ``` When I call it: ``` <?php require("users.php"); if(User::userNameExists($_GET['username'])) header("Location:index.php"); ?> ```