, . Iterator. , . , , - .
.
$users = new UserCollection();
$users->company = $companyid;
$user = $users[$userid];
// also
foreach( $users as $user ) {
// Do something for each user in the system
}
In the first part, I create a usercollection object and restrict its list of users to the company identifier. Then, when I access the collection, I get users with this identifier from this company. The second part allows me to sort through each user in the company.
source
share