本文整理汇总了PHP中Test::foo方法的典型用法代码示例。如果您正苦于以下问题:PHP Test::foo方法的具体用法?PHP Test::foo怎么用?PHP Test::foo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Test
的用法示例。
在下文中一共展示了Test::foo方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foo
function foo($int) : int
{
return parent::foo($int);
}
示例2: array
<?php
class Test
{
protected static $color = array('gray' => 30);
public static function foo($type, $key)
{
return isset(self::${$type}[$key]);
}
}
var_dump(Test::foo('color', 'gray'));
示例3: foo
<?php
class Test
{
public function foo()
{
return $this++;
}
}
$t = new Test();
var_dump($t->foo());
示例4: array
<?php
class Test extends mysqli
{
public $test = array();
function foo()
{
$ar_test = array("foo", "bar");
$this->test =& $ar_test;
}
}
$my_test = new Test();
$my_test->foo();
var_dump($my_test->test);
示例5: __call
public function __call($method, $args)
{
}
}
function do_throw()
{
throw new Exception();
}
try {
Test::foo(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
(new Test())->bar(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$f = function () {
};
$f->__invoke(do_throw());
} catch (Exception $e) {
echo "Caught!\n";
}
try {
$t = new Test();
$f->__invoke($t->bar(Test::foo(do_throw())));
} catch (Exception $e) {
echo "Caught!\n";
}
示例7: foo
<?php
interface TestInterface
{
public function foo();
public function bar(array $bar);
}
class Test implements TestInterface
{
public function foo(...$args)
{
echo __METHOD__, "\n";
}
public function bar(array $bar, ...$args)
{
echo __METHOD__, "\n";
}
}
$obj = new Test();
$obj->foo();
$obj->bar([]);
示例8: foo
<?php
interface ITest
{
const ITestConst = 42;
}
class Test implements ITest
{
public function foo($y = 'Test', $x = self::ITestConst)
{
var_dump($y::ITestConst);
var_dump(static::ITestConst);
var_dump(self::ITestConst);
var_dump($x);
}
}
$t = new Test();
$t->foo();
$rc = new ReflectionClass('Test');
$method = $rc->getMethod('foo');
foreach ($method->getParameters() as $param) {
var_dump($param->getDefaultValue());
}