Why am I getting this error the code works on the live demo the developer shows and its the same code? Any help would be most appreciated.
$method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ?: $_SERVER['REQUEST_METHOD'];
Why am I getting this error the code works on the live demo the developer shows and its the same code? Any help would be most appreciated.
$method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ?: $_SERVER['REQUEST_METHOD'];
The problem is not with the fact that the ternary operator is missing an argument as other stated. The problem is probably the PHP version of the server.
Straight from the PHP doc :
Since PHP 5.3, it is possible to leave out the middle part of the ternary operator. Expression expr1 ?: expr3 returns expr1 if expr1 evaluates to TRUE, and expr3 otherwise.
The way it is written is valid for any server with PHP version equal or above to 5.3.
Else it should be re-written in its equivalent expression :
$method = $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] ? $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] : $_SERVER['REQUEST_METHOD'];