[wp-trac] [WordPress Trac] #28666: Index key support for wp_list_pluck(), à la array_column()

WordPress Trac noreply at wordpress.org
Sun Jun 29 18:46:41 UTC 2014


#28666: Index key support for wp_list_pluck(), à la array_column()
-------------------------+------------------
 Reporter:  trepmal      |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.0
Component:  General      |     Version:
 Severity:  normal       |  Resolution:
 Keywords:  needs-patch  |     Focuses:
-------------------------+------------------
Changes (by nacin):

 * keywords:  has-patch => needs-patch
 * milestone:  Awaiting Review => 4.0


Comment:

 To optimize the speed of this as much as possible, can we put the if
 conditional outside of two different foreach loops? We should also reduce
 the is_object() calls to once per foreach iteration.

 We should include in the description for this function that this is an
 implementation of array_column() that also works with objects.

 I wish it only supported all objects or all arrays. As written, it does an
 is_object() each time. If we somehow knew it was an array of arrays, we
 could just have this wrap array_column() and get the performance benefits
 of C.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/28666#comment:3>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list