Array
(
    [1] => Array
        (
            [Id] => 4
            [EffectiveTo] => 
            [EffectiveFrom] => 
            [Name] => Square
            [New_Id] => 101
            [Location_Id] => 4
        )

[2] => Array
    (
        [Id] => 5
        [EffectiveTo] => 09/27/2011
        [EffectiveFrom] => 
        [Name] => Triangle
        [New_Id] => 101
        [Location_Id] => 6
    )

)


[3] => Array
    (
        [Id] => 3
        [EffectiveTo] => 
        [EffectiveFrom] => 
        [Name] => Circle Floor
        [New_Id] => 101
        [Location_Id] => 3
    )

[4] => Array
    (
        [Id] => 6
        [EffectiveTo] => 
        [EffectiveFrom] => 
        [Name] => Triangle
        [New_Id] => 101
        [Location_Id] => 6
    )

[4] => Array
    (
        [Id] => 7
        [EffectiveTo] => 
        [EffectiveFrom] => 
        [Name] => Circle_floor
        [New_Id] => 101
        [Location_Id] => 3
    )


I need to filter this array based on the value "name". So for example, in the above there are duplicate values of Triangle and Circle floor. I need to get rid of any multiple occurances. So there is only one indexed in the multidimensional array.

What is the best way to do this?

Cheers.

    How is the array created in the first place? Perhaps you can deal with your problem directly

    $arr = array();
    while ($something)
    {
    	$data = get_next_element();
    	$arr[$data[$name]] = $data;
    }
    

    Would give something like

    Array
    (
        [Square] => Array
            (
                [Id] => 4
                [EffectiveTo] => 
                [EffectiveFrom] => 
                [Name] => Square
                [New_Id] => 101
                [Location_Id] => 4
            )
    
    
    [Triangle] => Array
        (
            [Id] => 6
            [EffectiveTo] => 
            [EffectiveFrom] => 
            [Name] => Triangle
            [New_Id] => 101
            [Location_Id] => 6
        )
    
    [Circle_floor] => Array
        (
            [Id] => 7
            [EffectiveTo] => 
            [EffectiveFrom] => 
            [Name] => Circle_floor
            [New_Id] => 101
            [Location_Id] => 3
        )
    )
    
      Write a Reply...