I have this code:
我有这个代码:
while (list ($key, $val) = each ($ethnicity)) {
if ($val == '')
$ethnicity = '';
break;
}
and I get an error saying: Assignment in condition, Change to ==
我收到一个错误说:条件分配,改为==
But I can't change it to ==
or it's not working.
但是我无法将其更改为==或者它无效。
Anyone care to explain to me why this is happening?
有人在乎向我解释为什么会这样吗?
edit.
编辑。
the error is for the first line.
错误是第一行。
also i get the same error here:
我也得到同样的错误:
while (($row = mysql_fetch_row ($result)))
{
$sms_providerchecked0= $row[3];
$to_return_email12 = $cell."@$sms0";
}
in the first line
在第一行
3 个解决方案
#1
1
while ( false!=(list($key, $val)=each($ethnicity)) ) {
I don't have zend studio so this might or might not do the trick...
我没有zend工作室所以这可能会或可能不会成功...
#2
1
Have you tried putting an extra set or parentheses around the condition?
您是否尝试在条件周围添加额外的一组或括号?
IE:
IE:
while ((list ($key, $val) = each ($ethnicity)))
{
if ($val == '')
$ethnicity = '';
break;
}
Also, what IDE are you using, as this very likely could just be a problem with your IDE being overzealous about preventing unintentional assignments in condition.
另外,你使用的是什么IDE,因为这很可能只是你的IDE在防止无意中分配条件时过于热心的问题。
EDIT:
编辑:
As you are using zend, and your code is perfectly valid, it looks like if you want to stop seeing the warning so that you can write your code the way that you want to(this is an erroneous warning), you can disable that warning in Window | Preferences, PHP | Semantic Analysis.
当您使用zend,并且您的代码完全有效时,看起来如果您想要停止查看警告以便您可以按照您想要的方式编写代码(这是一个错误的警告),您可以禁用该警告在窗口中|首选项,PHP |语义分析。
#3
1
$row = mysql_fetch_row($result);
while ($row) {
$sms_providerchecked0= $row[3];
$to_return_email12 = $cell."@$sms0";
$row = mysql_fetch_row($result);
}
#1
1
while ( false!=(list($key, $val)=each($ethnicity)) ) {
I don't have zend studio so this might or might not do the trick...
我没有zend工作室所以这可能会或可能不会成功...
#2
1
Have you tried putting an extra set or parentheses around the condition?
您是否尝试在条件周围添加额外的一组或括号?
IE:
IE:
while ((list ($key, $val) = each ($ethnicity)))
{
if ($val == '')
$ethnicity = '';
break;
}
Also, what IDE are you using, as this very likely could just be a problem with your IDE being overzealous about preventing unintentional assignments in condition.
另外,你使用的是什么IDE,因为这很可能只是你的IDE在防止无意中分配条件时过于热心的问题。
EDIT:
编辑:
As you are using zend, and your code is perfectly valid, it looks like if you want to stop seeing the warning so that you can write your code the way that you want to(this is an erroneous warning), you can disable that warning in Window | Preferences, PHP | Semantic Analysis.
当您使用zend,并且您的代码完全有效时,看起来如果您想要停止查看警告以便您可以按照您想要的方式编写代码(这是一个错误的警告),您可以禁用该警告在窗口中|首选项,PHP |语义分析。
#3
1
$row = mysql_fetch_row($result);
while ($row) {
$sms_providerchecked0= $row[3];
$to_return_email12 = $cell."@$sms0";
$row = mysql_fetch_row($result);
}