本文整理汇总了PHP中Vehicle::getDescription方法的典型用法代码示例。如果您正苦于以下问题:PHP Vehicle::getDescription方法的具体用法?PHP Vehicle::getDescription怎么用?PHP Vehicle::getDescription使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Vehicle
的用法示例。
在下文中一共展示了Vehicle::getDescription方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Person
<?php
require_once 'autoload.php';
$person = new Person();
$person->setFirstName('Peter');
$person->setLastName('Pan');
echo $person->getInfo(), PHP_EOL;
$person2 = new Person();
$person2->setFirstName('Captain');
$person2->setLastName('Hook');
echo $person2->getInfo(), PHP_EOL;
$vehicle = new Vehicle();
$vehicle->setDescription('Very nice vehicle');
echo $vehicle->getDescription(), PHP_EOL;
$car = $vehicle;
$car->setDescription('Very nice car');
$o1 = new stdClass();
// {}| new Object()
$o2 = new stdClass();
// {}| new Object()
var_dump($vehicle->getDescription(), $car === $vehicle, $o1 === $o2);
示例2: changeDescription
<?php
require_once 'autoload.php';
$vehicle = new Vehicle('Ford');
function changeDescription($object)
{
$object->setDescription('New Description');
}
var_dump($vehicle->getDescription());
changeDescription($vehicle);
var_dump($vehicle->getDescription());