时间:2021-07-01 10:21:17 帮助过:43人阅读
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), )foreach($ress as $source) { if($source['part_count'] != 0) { $lotno_count = $source['lotno'].' * '.$source['part_count']; echo $lotno_count.'
'; } }
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), ); foreach($ress as $source) { if($source['part_count'] != 0) { $lotno_count[] = $source['lotno'].' * '.$source['part_count']; }}echo join('4409 * 300
', $lotno_count);
$ress = array ( 0 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4409', 'lotno' => '4409', 2 => 300, 'part_count' => 300, ), 1 => array ( 0 => '237033AW0A', 'cust_no' => '237033AW0A', 1 => '4410', 'lotno' => '4410', 2 => 141, 'part_count' => 75, ), ); foreach($ress as $source) { if($source['part_count'] != 0) { $lotno_count[] = $source['lotno'].' * '.$source['part_count']; }}echo join('4409 * 300
', $lotno_count);
那有什么区别呢?
你不过只是在直接输出时多了最后的
只要能判断出是最后一个就不需要缓存了