Home > Backend Development > PHP Tutorial > 循环的有关问题

循环的有关问题

WBOY
Release: 2016-06-13 10:27:30
Original
824 people have browsed it

循环的问题.
for($i=0;$i{
for($j=0;$j {
if($arr2[productcode][$i]!=$arr[code][$j])
{
$newcode=$arr["code"][$j];
$newprodcut=$arr["product"][$j];
$newdesc=$arr["desc"][$j];
$insert_sql="insert into xcart_products values('$newprodcut','$newcode','$newdesc')";
echo $insert_sql;
echo $db->execute($insert_sql);

}

}

}
如果不满足if条件的话,怎么跳出内层循环..

------解决方案--------------------
if(...)
{
...
}
else
{
break;
//或者
$j=count($arr[code])+1;
$i=count($arr2[productcode])+1;
}
------解决方案--------------------

PHP code
for($i=0;$i<count for if break j i class="clear">
                 
              
              
        
            </count>
Copy after login
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template