Parse error: parse error, unexpected T_VARIABLE in ... on line 11
Code: Select all
function insertFeedback($name, $type, $email, $text, $ip = $_SERVER['REMOTE_ADDR'], $time = time()) //line 11
{
blah blah blah
}Moderator: General Moderators
Code: Select all
function insertFeedback($name, $type, $email, $text, $ip = $_SERVER['REMOTE_ADDR'], $time = time()) //line 11
{
blah blah blah
}To implement the same functionality in a valid way, I'd do it like this:The default argument value must be a constant expression, not (for example) a variable, a class member or a function call.
http://www.php.net/manual/en/functions.arguments.php
Code: Select all
function insertFeedback($name, $type, $email, $text, $ip = '', $time = '') {
if ($ip == '') $ip = $_SERVER['REMOTE_ADDR'];
if ($time == '') $time = time();
// the rest of the function
}