本文整理匯總了PHP中Dog::dance方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dog::dance方法的具體用法?PHP Dog::dance怎麽用?PHP Dog::dance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dog
的用法示例。
在下文中一共展示了Dog::dance方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: __get
public function __get($key)
{
return $this->data[$key];
}
public function __call($name, $arguments)
{
var_dump($name);
var_dump($arguments);
}
public static function __callStatic($name, $arguments)
{
var_dump($name);
var_dump($arguments);
}
public function bark()
{
echo "Bark!";
}
public static function warning()
{
echo "Dog Bite!";
}
}
Dog::run("Pyay", 300);
$dog = new Dog("Aung Net", "Red");
$dog->test = "Testing";
$dog->goo = "Foo";
echo $dog->test;
echo $dog->goo;
$dog->dance("Aung Net", 4);
示例2: run
public function run()
{
// TODO: Implement run() method.
}
public function eat()
{
// TODO: Implement eat() method.
}
public function sleep()
{
// TODO: Implement sleep() method.
}
}
Dog::warning();
// scope resolution operator
Dog::fool("bar");
// late method binding
Dog::bark();
// -------------------
$dog = new Dog();
$dog->color = "Red";
// property binding
// echo $dog->color;
// $dog->warning();
$dog->dance("crazy", "foo", "bar", "moo");
$dog2 = new Dog();
$dog2->bark();
// Singaleton
$cat = new Cat("Shwe War");
$cat->name = "Shwe War";
echo $cat->name;