标签:blog for ar 2014 log size on c php
<?php $arr = array( 'a' => '0a0', 'b' => '0b0', 'c' => '0c0', 'd' => '0d0', 'e' => '0e0', ); //********break********// //用来跳出目前执行的循环,并不再继续执行循环了。 foreach($arr as $k => $v){ if($k == 'c'){ break; } $arr2[$k] = $v; } var_dump($arr2); /* array (size=2) 'a' => string '0a0' (length=3) 'b' => string '0b0' (length=3) */ //********continue********// //立即停止目前执行循环,并回到循环的条件判断处,继续下一个循环。 foreach($arr as $k => $v){ if($k == 'c'){ //忽略对这一项的处理 continue; } $arr3[$k] = $v; } var_dump($arr3); /* array (size=4) 'a' => string '0a0' (length=3) 'b' => string '0b0' (length=3) 'd' => string '0d0' (length=3) 'e' => string '0e0' (length=3) */ ?>
标签:blog for ar 2014 log size on c php
原文地址:http://blog.csdn.net/moqiang02/article/details/38781513