The PHP array is split into two arrays based on key values

Warriors, there is an array of case information. Now I want to separate the cases with the character "[pre]" in anjian_title to form a new array. How to write this for loop?

Aug.23,2021

$newArr = [];
foreach($arr as $key => $val)
{
    if(strpos($val['anjian_title'], '[]') !== false){
        $newArr[] = $arr[$key];
    }
}

$arr1 = array_map(function($item) {
    return strpos($item['anjian_title'], '[]') !== false;
}, $arr);
$arr2 = array_map(function($item) {
    return strpos($item['anjian_title'], '[]') === false;
}, $arr);
Menu