Removes duplicates values from an multidimensional array (PHP)

The idea: Serialize the item of the item (array) of the multidimensional array

Than Sort out the same item.

// serialize — Generates a storable representation of a value
$workArr =array();
foreach ($newDateArr as $value) {
$workArr[]= serialize ( $value );
}

$workArr = array_unique($workArr);

//unserialize — Creates a PHP value from a stored representation
$workArr2 =array();
foreach ($workArr as $value) {
$workArr2[]= unserialize( $value );
}

other source – but this was not worked for me:

How to remove duplicate values from a multi-dimensional array in PHP

http://stackoverflow.com/questions/307674/how-to-remove-duplicate-values-from-a-multi-dimensional-array-in-php

B logbook : PHP | Javascript | Laravel | CodeIgniter | VueJs | ReactJs | WordPress

Translate »