本文整理汇总了PHP中Animal::wacky方法的典型用法代码示例。如果您正苦于以下问题:PHP Animal::wacky方法的具体用法?PHP Animal::wacky怎么用?PHP Animal::wacky使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Animal
的用法示例。
在下文中一共展示了Animal::wacky方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: usort
}
echo "<br/>";
}
echo "<br/>";
// However, to sort, we need a comparator that takes two objects as
// arguments, so as to work with the usort framework. Note the
// somewhat odd syntax below. The second argument to the usort
// function is actually an array with the class name and method name
// as a pair. This is needed if the comparator is a method within
// a class.
usort($A, array('Animal', 'compare'));
echo "Output in sorted order:<br/>";
foreach ($A as $animal) {
echo "{$animal}<br/>";
}
echo "<br/>";
usort($A, array('Animal', 'compareTwo'));
echo "Output in sorted order:<br/>";
foreach ($A as $animal) {
echo "{$animal}<br/>";
}
echo "<br/>";
// We can call static methods using the scope resolution operator
Animal::wacky();
// Objects are automatically destructed at the end of the script, so
// uncommenting the line below will have no effect
//unset($A);
?>
</body>
</html>