[wp-trac] [WordPress Trac] #27765: Add ARRAY_K return type to wpdb::get_results()
WordPress Trac
noreply at wordpress.org
Fri Apr 11 20:25:03 UTC 2014
#27765: Add ARRAY_K return type to wpdb::get_results()
-------------------------+-----------------------------
Reporter: jdgrimes | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Database | Version: trunk
Severity: normal | Keywords:
Focuses: |
-------------------------+-----------------------------
This is a request to add the `ARRAY_K` return type to
`wpdb::get_results()` to compliment the `OBJECT_K` type (#5286). This
would cause the method to return an array of associative arrays indexed by
the value of the first column. In other words, like `ARRAY_A` except
indexed by the first column's value.
{{{
Array (
['value_1'] => Array (
['col_1'] => ['value_1']
['col_2'] => ['value_2']
)
...
)
}}}
I've thought to myself on multiple occasions that this would have been
nice to have. Apparently nobody else has though (or didn't think it was
worth a ticket), so maybe there really aren't that many use-cases for it.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/27765>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list