本文整理匯總了PHP中Dog::sayBreed方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dog::sayBreed方法的具體用法?PHP Dog::sayBreed怎麽用?PHP Dog::sayBreed使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dog
的用法示例。
在下文中一共展示了Dog::sayBreed方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: sayBreed
$this->name = 'dog';
$this->age = $age;
}
public function sayBreed()
{
echo 'My breed is ' . $this->breed;
}
// kill the dog
// this happens when the object is destroyed
public function __destruct()
{
unset($this->name);
}
}
function say_animal_name($name)
{
echo 'I am a ' . $name;
}
function sayDogBreed($breed)
{
echo 'My breed is ' . $breed;
}
$dog = new Dog(12);
$dog->breed = 'labrador';
$dog->sayName();
echo '<br>';
$dog->sayBreed();
echo '<br>';
echo 'the color is ' . Dog::$color;
echo '<br>';
echo 'i have ' . Dog::TEETH . ' teeth';
示例2: dirname
<?php
require_once dirname(__FILE__) . '/Pet.php';
require_once dirname(__FILE__) . '/Dog.php';
$myDog = new Dog("Raya", 4, "Labrador");
$myDog->greet();
$myDog->sayBreed();