STRING, expecting '(' in

I've been trying to do a ranking system for a friend. Everything's ready, but an error gets in the way. The error:

Parse error: syntax error, unexpected T_STRING, expecting '(' in /blablabla/sn_rank.php on line 8

Here's my code:

<?
function lul($pts, $low, $high) {
if($pts <= $low) return false;
if($pts >= $high) return false;
return true;
}
function get_rank($pts){
if lul($pts, "0", "75"){
return "Newcomer";
}
if lul($pts, "75", "175"){
return "Junior";
}
if lul($pts, "175", "325"){
return "Senior";
}
if lul($pts,"325", "525"){
return "Advanced";
}
if lul($pts, "525", "775"){
return "Veteran";
}
}
echo get_rank($_GET['pts']);
?>

Please don't downnote, I'm new here. Thank you in advance.


The correct syntax for if is, according to http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_language_parser.y#284:

if (expr)

So use every time:

if (lul(...)) { ... }

You need to do this:

if(lul($pts, "0", "75")){
  return "Newcomer";
}

Notice how it is wrapped in brackets?

链接地址: http://www.djcxy.com/p/69702.html

上一篇: 解析错误:语法错误,意外的'[',期待')'

下一篇: STRING,期待'('in