您可以迭代数组,搜索特定记录(一次只能搜索一次),也可以使用另一个关联数组来构建哈希图。
对于前者,像这样
$item = null;foreach($array as $struct) { if ($v == $struct->ID) { $item = $struct; break; }}
您可以迭代数组,搜索特定记录(一次只能搜索一次),也可以使用另一个关联数组来构建哈希图。
对于前者,像这样
$item = null;foreach($array as $struct) { if ($v == $struct->ID) { $item = $struct; break; }}