Possible Duplicate:
Reference – What does this symbol mean in PHP?
The third line of the following code, works well in my local environment but returns an error on my production server.
What does the & prefix mean and why is it returning an error on my production server?
Below is my code;
function add_real_escape_string($value) {
if (is_array($value)) {
foreach($value as &$item) {
$item = add_real_escape_string($item);
}
} else {
if (get_magic_quotes_gpc()) {
$value = stripslashes($value);
}
$value = mysql_real_escape_string($value);
}
return $value;
}
The error returned is:
Parse error: syntax error, unexpected ‘&’, expecting T_VARIABLE or ‘$’ in init.php on line 345
The & means that it passes the reference rather than a copy, meaning that all changes you make to that object will also reflect outside of the scope it is used in. See http://php.net/manual/en/language.references.pass.php for more info.
To explain the error, we’d have to know what error you’re getting. Would you mind pasting it for us?