当前位置: 首页>>代码示例>>PHP>>正文


PHP Employee::work方法代码示例

本文整理汇总了PHP中Employee::work方法的典型用法代码示例。如果您正苦于以下问题:PHP Employee::work方法的具体用法?PHP Employee::work怎么用?PHP Employee::work使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Employee的用法示例。


在下文中一共展示了Employee::work方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: work

<?php

class Employee
{
    public $name;
    public $age;
    public $job;
    public $salary;
    public function work()
    {
        echo '働いている!';
    }
}
$saji = new Employee();
// Employeeクラスのインスタンスを生成
$saji->work();
//インスタンスからメソッドを呼び出す
开发者ID:slogan-tech,项目名称:object_oriented,代码行数:17,代码来源:employee.php

示例2: Person

include_once "Entities\\Manager.php";
include_once "Entities\\Department.php";
$ivan = new Person("vano", 111);
//        $ivan -> id = 111123;
//        $ivan -> name = "vano";
echo $ivan->getName() . "\n";
echo $ivan->getId() . "\n";
echo $ivan->__get("name") . "\n";
echo $ivan->__get("id") . "\n";
$ivanSalary = $ivan->__get("salary") . "\n";
$ivanAge = $ivan->age . "\n";
// неявно вызывает функцию __get
echo "ivan has salary :" . $ivanSalary;
echo "ivan has age :" . $ivanAge;
$he = new Employee();
$hisResult = $he->work(true);
echo "Он работал весь день и результат: " . $hisResult . "\n";
$she = new Manager(10000000);
$herSalary = $she->salary;
echo "Она не работала весь день и ее зарплата: " . $herSalary . "\n";
$employees = array();
$department = new Department("IT", $employees, $she);
$she->hire($ivan);
$allEmployees = $department->getEmployees();
printAllEmployees($allEmployees);
$she->hire($he);
$allEmployees = $department->getEmployees();
printAllEmployees($allEmployees);
$she->fire($he);
$allEmployees = $department->getEmployees();
printAllEmployees($allEmployees);
开发者ID:Aktubius,项目名称:Lesons_SAG,代码行数:31,代码来源:index.php

示例3: 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() . '&euro; op zijn spaarboekje staan.';
$dialog[] = $werknemer->work(8);
$dialog[] = 'De werknemer ' . $werknemer->getName() . ' heeft ' . $werknemer->getSavings() . '&euro; op zijn spaarboekje staan.';
// Method uit de parent class
require_once 'voorbeeld-classes-inheritance-parent-view.php';
开发者ID:gurbuzhasan,项目名称:web-backend,代码行数:14,代码来源:voorbeeld-classes-inheritance-parent.php

示例4: Task

$t9 = new Task("Task 9", 3);
$t10 = new Task("Task 10", 2);
$t11 = new Task("Task 11", 2);
$t12 = new Task("Task 12", 2);
$allWork = new AllWork();
$allWork->addTask($t1);
$allWork->addTask($t2);
$allWork->addTask($t3);
$allWork->addTask($t4);
$allWork->addTask($t5);
$allWork->addTask($t6);
$allWork->addTask($t7);
$allWork->addTask($t8);
$allWork->addTask($t9);
$allWork->addTask($t10);
$allWork->addTask($t11);
$allWork->addTask($t12);
$e1 = new Employee("Ivan", $allWork);
$e2 = new Employee("Niki", $allWork);
$e3 = new Employee("Tina", $allWork);
$moreWork1 = false;
$moreWork2 = false;
$moreWork3 = false;
$days = 1;
while (!$moreWork1 || !$moreWork2 || !$moreWork3) {
    echo 'Start working day number ' . $days . PHP_EOL;
    $days++;
    $moreWork1 = $e1->work();
    $moreWork2 = $e2->work();
    $moreWork3 = $e3->work();
}
开发者ID:gpichurov,项目名称:ittalents_season5,代码行数:31,代码来源:index.php


注:本文中的Employee::work方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。