Q:

Select all the keys inside arrays (inside another array) that contain the same value

My point here is, some keys with the value "nit" are have the same value in many arrays (such as arrays 21, 23 and 24). I want to select all the arrays that have the same "nit" and create a new array with all of those. I need one array (from all the ones with same "nit") to remain in the main array(randomly pick one).
[20] => Array
            (
                [fecha] => 2018-08-27 18:38:49
                [id_cliente] => 
                [nit] => 50255872726
                [destino] => Copartes.Gt
                [nombre] => Registrar Cliente
                [telefono] => 55872726
                [type] => IN
                [mensaje] => Mandame el número de cuenta y te voy a depositar
            )

        [21] => Array
            (
                [fecha] => 2018-08-27 18:36:20
                [id_cliente] => 110099
                [nit] => 3108449-4
                [destino] => Copartes.Gt
                [nombre] => Guillermo Suhr
                [telefono] => 42150465
                [type] => IN
                [mensaje] => Muchas gracias
            )

        [22] => Array
            (
                [fecha] => 2018-08-27 18:30:05
                [id_cliente] => 27523
                [nit] => 1241764-5
                [destino] => Copartes.Gt
                [nombre] => Manuel Garcia
                [telefono] => 53186931
                [type] => IN
                [mensaje] => Gracias
            )

        [23] => Array
            (
                [fecha] => 2018-08-27 18:30:00
                [id_cliente] => 110099
                [nit] => 3108449-4
                [destino] => Copartes.Gt
                [nombre] => Guillermo Suhr
                [telefono] => 42150465
                [type] => IN
                [mensaje] => Gracias
            )

        [24] => Array
            (
                [fecha] => 2018-08-27 18:30:00
                [id_cliente] => 110099
                [nit] => 3108449-4
                [destino] => Copartes.Gt
                [nombre] => Guillermo Suhr
                [telefono] => 42150465
                [type] => IN
                [mensaje] => Buena tarde

A:

Just filter the array:
$a = array_filter($a, function($val) {
    static $set = []; // collect nits
    $nit = $val['nit'];
    if (!isset($set[$nit])) { // new nit
        return $set[$nit] = true; // true
    }
    return false;
});

Explanation:
The filter callback is a function that is called for each array element. (Since there are no flags passed to array_filter(), the callback receives the array value only.) This function has a static variable which exists only local in the function scope and doesn't lose it's value when the function call has completed. It collects all nit values so far and returns true if seen for the first time and false else.

