开发者

Netbeans PHP Validation sees endif as a syntax error

I have this part of code

<?php for ($j=0; $j < $count; $j++开发者_高级运维): ?>
    <?php if(isset($votes[$j])): ?>
          <dt>something something</dt>
          <dd>
              <span><?php echo $result; ?>%</span>
              <div class="bar">
              </div>
          </dd>
    <?php else: ?>
          <dt>info</dt>
          <dd>
              <span>0</span>
              <div class="bar">
                  <div style="width: 0px"></div>
              </div>
          </dd>
    <?php endif; ?>
<?php endfor; ?>

now Netbeans insists that on the endif line (near the end) there's a syntax error:

Error Syntax error: expected: exit, identifier, variable, function...

Is there some sort of known problem with the validation of endif on Netbeans ?


I'm using NetBeans 6.8. Tried your code and it doesn't have problem with endif, instead it said there's something wrong with <dd>. I believe there's mistake on 2nd line, votes[$j] should be $votes[$j].


votes should be $votes


Using if( condition ): ... endif; is valid, maybe it's just a case of NetBeans not being configured to see them as such, in which case it would be something to address to their support team.


<?php for ($j=0; $j < $count; $j++): ?>

should be

<?php for ($j=0; $j < $count; $j++){ ?>

and dont forget the closing tag at the end }

But the guy above me is right ;)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜