(array) Array
(
[0] => WP_Term Object
(
[term_id] => 1474
[name] => Bij
[slug] => bij
[term_group] => 0
[term_taxonomy_id] => 1474
[taxonomy] => brand_name
[description] =>
[parent] => 0
[count] => 14
[filter] => raw
[term_order] => 0
)
[1] => WP_Term Object
(
[term_id] => 1109
[name] => Cal
[slug] => cal
[term_group] => 0
[term_taxonomy_id] => 1109
[taxonomy] => brand_name
[description] =>
[parent] => 0
[count] => 16
[filter] => raw
[term_order] => 0
)
[2] => WP_Term Object
(
[term_id] => 1166
[name] =>Glue-
[slug] => clear-glue
[term_group] => 0
[term_taxonomy_id] => 1166
[taxonomy] => brand_name
[description] =>
[parent] => 0
[count] => 3
[filter] => raw
[term_order] => 0
)
我有一个搜索字词($ brand_query),我正在与上述数组($ brand_names)的子弹和类似名称进行比较
for($i=0; $i<sizeof($brand_names); $i++){
if($brand_query==$brand_names[$i]->name||$brand_query1==$brand_names[$i]->slug){//if search matches with the name or slug do something
}
}
使用array_search或任何此类内置函数可以提高搜索和比较的速度吗?