本文整理汇总了PHP中Base::foo方法的典型用法代码示例。如果您正苦于以下问题:PHP Base::foo方法的具体用法?PHP Base::foo怎么用?PHP Base::foo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Base
的用法示例。
在下文中一共展示了Base::foo方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: main
function main(Base $b)
{
$x = $b->foo();
var_dump($x);
}
示例2: foo
<?php
class Base
{
public $aaa = 1;
protected $bbb = 2;
private $ccc = 3;
function foo($obj)
{
var_dump(get_class($obj));
var_dump(get_object_vars($obj));
}
}
class Child extends Base
{
public $ddd = 5;
protected $eee = 6;
private $fff = 4;
}
$base_obj = new Base();
$base_obj->foo($base_obj);
示例3: foo
<?php
class Base
{
public $aaa = 1;
protected $bbb = 2;
private $ccc = 3;
function foo($obj)
{
var_dump(get_class($obj));
var_dump(get_object_vars($obj));
}
}
class Child extends Base
{
public $ddd = 4;
protected $eee = 5;
private $fff = 6;
}
$base_obj = new Base();
$child_obj = new Child();
$base_obj->foo($child_obj);
示例4: main
function main(Base $b)
{
$x = $b->foo();
$x->say();
}
示例5: __callStatic
<?php
class Base
{
public static function __callStatic($method, $args)
{
$klass = get_called_class();
echo "class {$klass}\n";
}
}
class Derived extends Base
{
}
Base::foo();
Derived::foo();