if($player[$x]->name == $p->name || $player[$x]->name == $target) unset $player[$x]; //<-- line 215
commenting out this line removes the error:
PHP Parse error: syntax error, unexpected T_VARIABLE, expecting '(' in /path/script.php on line 215
But I don't see were it's expecting a (, am I missing something obvious?
unset()
is a language construct that requires parentheses; you must use unset($player[$x]);
.
unset is a function, you need to call it with parentheses, like this: unset( $player[ $x ] )
you'd better separate your code to different lines to see where the problem is more easily.
未设置需要括号:
if($player[$x]->name == $p->name || $player[$x]->name == $target) unset($player[$x]);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.