Remove duplicated from multidimensional array

Have an array with this expression $products[] = $product[$category_id][$product_id]:

$products = array(
    33 => array(
        31 => array(
            'model' => 'Product 4',
            'product_id' => 31,
            'sku' => '',
            'ean' => '1234',
            'price' => '80.0000'
        ),
        8733 => array(
            'model' => 'qqq',
            'product_id' => 8733,
            'sku' => '',
            'ean' => '1000',
            'price' => '344.6281'
        )
    ),
    25 => array(
        30 => array(
            'model' => 'Product 3',
            'product_id' => 30,
            'sku' => '',
            'ean' => '250',
            'price' => '50.4132'
        ),
        31 => array(
            'model' => 'Product 4',
            'product_id' => 31,
            'sku' => '',
            'ean' => '1234',
            'price' => '80.0000'
        )
    )
);

I need remove duplicated product in php and result must be:

$products = array(
    33 => array(
        8733 => array(
            'model' => 'qqq',
            'product_id' => 8733,
            'sku' => '',
            'ean' => '1000',
            'price' => '344.6281'
        )
    ),
    25 => array(
        30 => array(
            'model' => 'Product 3',
            'product_id' => 30,
            'sku' => '',
            'ean' => '250',
            'price' => '50.4132'
        ),
        31 => array(
            'model' => 'Product 4',
            'product_id' => 31,
            'sku' => '',
            'ean' => '1234',
            'price' => '80.0000'
        ),
    )
);

I have tried this:

$cleared_products = array();

        foreach ($products as $category_id => $category_products) {
            foreach ($category_products as $product_id => $product) {
                if (isset($cleared_products[$category_id][$product_id])) {
                    
                    unset($products[$category_id][$product_id]);
                } else {
                    
                    $cleared_products[$category_id][$product_id] = $product;
                }
            }
        }

But does not work…