<?php
function find($text,$openpos)
{
$closepos=$openpos;
$counter=1;
while($counter>0)
{
$c=$text[++$closepos];
if($c=='(')
{
$counter++;
}
else if($c==')')
{
$counter--;
}
}
return $closepos;
}
$c=find("(1+2*(5-2)/(3-1))","6");
echo $c;
?>
显示错误
“sh:-c:第0行:意外令牌附近的语法错误
(' sh: -c: line 0:
php main.php(1 + 2 *(5-2)/(3-1))6'”
如何解决这个问题?
答案 0 :(得分:-1)
更改此行:
else if(c==')')
要:
else if($c==')')