Skip to content
This repository was archived by the owner on Jan 8, 2019. It is now read-only.
This repository was archived by the owner on Jan 8, 2019. It is now read-only.

Support for objects? #2

@jlem

Description

@jlem

It would be great if you could pass in an array of objects, and the index key provided merely accessed one of the properties to be used when re-indexing the array of objects.

I know that you can implement the ArrayAccess interface, but it's a bit tedious to do this for every object that you just want to be able to reindex an array of.

A simple check to see if $row is an object would be good. A more robust implementation might allow you to define a method call against a class as the index key e.g. array('Person', 'getID').

Of course this would make it inconsistent with the actual PHP implementation, but it would make this more useful. Having to implement ArrayAccess marginally defeats the purpose of using the terse syntax of array_column() over the slightly more verbose array_map()

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions