由于逗号引起的php逻辑语句synatx错误

鲁奇卡

谁能帮忙

<?php 
if(((count( $replies ) > 6) and 
(count( $replies ) <= 12)) and 
($replyNumber == '3','4','5'))
{ ?>
<execute code......>
<?php } ?>

为什么由于使用逗号(以3,4,5的回复数表示)在代码中出现错误

Pritamkumar

您的代码有错误

($replyNumber == '3','4','5'))

它可能像

($replyNumber == '3' && $replyNumber == '4' && $replyNumber == '5'))

在你的代码中

'and' 

应该转换'&&''and'php中不允许的

和完整的代码就像

<?php 
 if(((count( $replies ) > 6) &&
  (count( $replies ) <= 12)) && 
  ($replyNumber == '3' && $replyNumber == '4' && $replyNumber == '5'))
{ ?>
<execute code......>
<?php } ?>

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章