Reputation: 426
Kindly can someone guide me on how to achieve this?
Company
and define attributes Company Name
,
Company Address
.Employees
and define attributes Employee Name
,
Phone Number
, and Email
.Company
can have multiple Employees
in such a way as to
retrieve company and its employee information through its
Company
object.Upvotes: 1
Views: 299
Reputation: 38144
You need to create Employee
class:
class Employee
{
public $name
public $phoneNumber
public $mail
}
and Company class:
class Company
{
public $name;
public $address;
public $matchCount;
public $employees = array();
}
You can use the following snippet:
$company = new Company();
$company->employees[0] = new Employee();
Upvotes: 1