Yiannis Christodoulou

15+ years experience in web development, mostly with Joomla! & WordPress

Back to blog

Filter the Unique Objects in a PHP object array

Before:

[0] => stdClass Object(
                    [id] => 1,
                    [name] => “Yiannis”
                )
        [1] => stdClass Object(
                    [id] => 2,
                    [name] => “George”
                )
        [2] => stdClass Object(
                    [id] => 3,
                    [name] => “Yiannis”
                )
After:
 [0] => stdClass Object(
                    [id] => 1,
                    [name] => “Yiannis”
                )
        [1] => stdClass Object(
                [id] => 2,
                [name] => “George”
            )
Usage:
returnUniqueProperty($array, ‘name’);
PHP Function

Loading ...

Leave a comment