本文整理汇总了PHP中Employee::getName方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::getName方法的具体用法?PHP Employee::getName怎么用?PHP Employee::getName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Employee
的用法示例。
在下文中一共展示了Employee::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: addEmployee
function addEmployee(Employee $e)
{
$this->_employees[] = $e;
echo "<p>{$e->getName()} has been added to the {$this->_name} department.</p>";
}
示例2: Employee
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Employees</title>
</head>
<body>
<h3>Employees</h3>
<?php
include './Employee.php';
include './Manager.php';
$emp1 = new Employee();
$emp1->setName("Raynald");
echo "{$emp1->getName()}";
// $emp1->name = "Pancho"; // Causes error
$manager = new Manager();
$manager->setName('raynaldmo');
echo "{$manager->getName()}";
?>
</body>
</html>
示例3: setPhone
}
function setPhone($phone)
{
$this->phone = $phone;
}
function getPhone()
{
return $this->phone;
}
function printPersonInfo()
{
echo "<hr><b>Employee Info</b><br>";
echo $this->name . "<br>\n";
echo $this->address . "<br>\n";
echo $this->phone . "<br>\n";
}
}
// Create objects of the class
$Heidi = new Employee();
$Heidi->setName("Heidi Clum");
$Heidi->setAddress("1234 Somewhere Blvd ");
$Heidi->setPhone("123-456-7890");
echo $Heidi->getName() . "<br>\n";
echo $Heidi->getAddress() . "<br>\n";
echo $Heidi->getPhone() . "<br>\n";
$Brad = new Employee();
$Brad->setName("Brad Bit");
$Brad->setAddress("4321 Sunset Blvd ");
$Brad->setPhone("987-654-3210");
$Heidi->printPersonInfo();
$Brad->printPersonInfo();
示例4: Employee
<?php
require_once 'Person-class.php';
require_once 'Employee-class.php';
$werknemer = new Employee('Ryan', 'Carsonified');
// Instantie aanmaken van de klasse Employee
// Aangepaste employee klasse
//$werknemer = new Employee('Ryan', 'Carsonified'); // Instantie aanmaken van de klasse Employee
$dialog;
$dialog[] = 'De werknemer ' . $werknemer->getName() . ' werkt bij ' . $werknemer->getCompany() . ' en heeft ' . $werknemer->getSavings() . '€ op zijn spaarboekje staan.';
$dialog[] = $werknemer->work(8);
$dialog[] = 'De werknemer ' . $werknemer->getName() . ' heeft ' . $werknemer->getSavings() . '€ op zijn spaarboekje staan.';
// Method uit de parent class
require_once 'voorbeeld-classes-inheritance-parent-view.php';
示例5: add
/**
* Used to add composite members to the class
* Uses type hinting to expect an Employee obj which is then added to the internal array
* @param Employee $e
*/
function add(Employee $e)
{
$this->_employees[] = $e;
echo "<p><strong>{$e->getName()}</strong> has been added to the team <strong>{$this->getName()}</strong>.</p>";
}
示例6: __construct
{
public $name;
public $age;
public $job;
public $salary;
public function __construct()
{
$this->name = "名無しさん";
$this->age = 0;
$this->job = "研修員";
$this->salary = 300;
}
public function work()
{
echo '働いている!';
}
public function getName()
{
return $this->name;
}
public function setName($name)
{
$this->name = $name;
}
}
$saji = new Employee();
echo $saji->getName() . "<BR>";
//名無しさん
$saji->setName("佐治");
echo $saji->getName() . "<BR>";
//佐治
示例7: setName
<?php
class Test
{
public $name;
public function setName($name)
{
$this->name = $name;
}
public function getName()
{
return $this->name;
}
}
class Employee extends Test
{
public function __toString()
{
echo $this->name;
}
}
$me1 = new Employee();
$me1->setName('Joshua');
echo $me1->getName();
示例8: add
function add(Employee $e)
{
$this->_employees[] = $e;
echo "<p>{$e->getName()} has been added to team {$this->getName()}.</p>";
}
示例9: __construct
private $first_name;
private $last_name;
private $age;
private $job;
private $salary;
public function __construct()
{
$this->last_name = "名無し";
$this->first_name = "さん";
$this->age = 0;
$this->job = "研修員";
$this->salary = 300;
}
public function work()
{
echo '働いている!';
}
public function getName()
{
return $this->last_name . " " . $this->first_name;
}
public function setName($last_name, $first_name)
{
$this->last_name = $last_name;
$this->first_name = $first_name;
}
}
$saji = new Employee();
$saji->setName("佐治", "和弘");
echo $saji->getName();
//佐治 和弘