【发布时间】:2018-05-27 14:33:56
【问题描述】:
我有班级“list_member”:
class list_member
{
public $id;
public $email;
public $lastchange;
public $active;
public $hash;
public $list_id;
function __construct($id,$email,$lastchange,$active,$hash,$list_id)
{
$this->id = $id;
$this->email = $email;
$this->lastchange = $lastchange;
$this->active = $active;
$this->hash = $hash;
$this->list_id = $list_id;
}
}
我有一个 list_members 数组。现在我想获得具有唯一 id ($this->id) 的成员,例如42.
如果不遍历整个数组并检查每个条目,这怎么可能?
【问题讨论】:
-
什么版本的 PHP?
-
你为什么要这么做
without looping?