有没有一种方法可以像在普通的array_map()循环中那样对内置方法array_map()的迭代进行break或continue?
例如:
array_map(function (String s) {
if (condition is met){
continue;
}
return stuff;
}, $array_to_map);发布于 2021-11-29 07:48:20
你可以像这样试一试:
$newArrayWithIds = [];
array_map(function (int $id) use ($newArrayWithIds): void {
if($id === 0) {
return;
}
$newArrayWithIds[] = $id;
}, $yourArrayWithIds);https://stackoverflow.com/questions/54138330
复制相似问题