public function divideParentFromChildren($customFieldsArr)
    {
        $parents = [];
        $children = [];
        for ($i = 0; $i < count($customFieldsArr); $i++){

            if(!$customFieldsArr[$i]['parentID']) {
                $parents[] = $customFieldsArr[$i];
            }else{
                if(!isset($children[$customFieldsArr[$i]['parentID']])) {
                    $children[$customFieldsArr[$i]['parentID']] = [];
                }
                $children[$customFieldsArr[$i]['parentID']][] = $customFieldsArr[$i];
            }
        }
        return array('parents' => $parents, 'children' => $children);
    }
public function divideParentFromChildren($customFieldsArr)
    {
        $parents = [];
        $children = [];
        for ($i = 0; $i < count($customFieldsArr); $i++){

            if(!$customFieldsArr[$i]['parentID']) {
                $parents[] = $customFieldsArr[$i];
            }else{
                if(!isset($children[$customFieldsArr[$i]['parentID']])) {
                    $children[$customFieldsArr[$i]['parentID']] = [];
                }
                $children[$customFieldsArr[$i]['parentID']][] = $customFieldsArr[$i];
            }
        }
        return array('parents' => $parents, 'children' => $children);
    }
public function divideParentFromChildren ( $ customFieldsArr ) { $ parents = [ ] ; $ children = [ ] ; for ( $ i = 0 ; $ i < count ( $ customFieldsArr ) ; $ i ++ ) { if ( ! $ customFieldsArr [ $ i ] [ 'parentID' ] ) { $ parents [ ] = $ customFieldsArr [ $ i ] ; } else { if ( ! isset ( $ children [ $ customFieldsArr [ $ i ] [ 'parentID' ] ] ) ) { $ children [ $ customFieldsArr [ $ i ] [ 'parentID' ] ] = [ ] ; } $ children [ $ customFieldsArr [ $ i ] [ 'parentID' ] ] [ ] = $ customFieldsArr [ $ i ] ; } } return array ( 'parents' => $ parents , 'children' => $ children ) ; }
Divides Fields from sub fields in two different arrays.

@param  array $customFieldsArr array of custom fields
@return array of custom fields
Divides Fields from sub fields in two different arrays .