【发布时间】:2015-03-29 11:11:00
【问题描述】:
我正在尝试过滤以下多维数组:
Array (
[0] => stdClass Object ( [term_id] => 5 [name] => Freelance [slug] => freelance-category1 [term_group] => 0 [term_taxonomy_id] => 5 [taxonomy] => job_listing_type [description] => [parent] => 0 [count] => 0 )
[1] => stdClass Object ( [term_id] => 2 [name] => Full Time [slug] => full-time-category2 [term_group] => 0 [term_taxonomy_id] => 2 [taxonomy] => job_listing_type [description] => [parent] => 0 [count] => 0 )
[2] => stdClass Object ( [term_id] => 6 [name] => Internship [slug] => internship-category1 [term_group] => 0 [term_taxonomy_id] => 6 [taxonomy] => job_listing_type [description] => [parent] => 0 [count] => 0 )
[3] => stdClass Object ( [term_id] => 3 [name] => Parta Time [slug] => part-time-category2 [term_group] => 0 [term_taxonomy_id] => 3 [taxonomy] => job_listing_type [description] => [parent] => 0 [count] => 0 )
[4] => stdClass Object ( [term_id] => 4 [name] => Temporary [slug] => temporary-category1 [term_group] => 0 [term_taxonomy_id] => 4 [taxonomy] => job_listing_type [description] => [parent] => 0 [count] => 0 ) )
我想将 [slug] => something-category1 的每个项目过滤到一个不同的数组中,并将 [slug] => something-category2 到一个不同的数组中。过滤的标准是hip-fun之后的结尾部分。
任何帮助将不胜感激。
【问题讨论】:
-
试试
foreach和explode
标签: php arrays multidimensional-array