【发布时间】:2018-03-24 04:00:39
【问题描述】:
我想比较一个 php 数组中的两个值,但是当我比较时代码停止,即使条件为真我想知道如何比较这两个值这是我的代码:
$i=0;$cmpt=0;
foreach($newarray as $newarray1){
$j=0;
while ($newarray1[$i]!==$newarray1[$j]){ // the iteration dont get in here even when the condition is true
$j+1;
var_dump($j);
}
if ($i=$j){
$couleur[]=$Tcouleur[$cmpt];
$cmpt+1;
}else{
$couleur[]=$Tcouleur[$j];
}
$i+1;
}
var_dump($couleur);
【问题讨论】:
-
$j+1是no-op。 -
能否请您详细说明问题
-
if ($i=$j)- 你应该阅读 = vs. == 和 ===