當前位置: 首頁>>代碼示例>>PHP>>正文


PHP foo類代碼示例

本文整理匯總了PHP中foo的典型用法代碼示例。如果您正苦於以下問題:PHP foo類的具體用法?PHP foo怎麽用?PHP foo使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了foo類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: barfunc

 public function barfunc()
 {
     // funcdef 1
     $x = new foo();
     // call 0
     $x->foofunc();
     // call 1
 }
開發者ID:scoates,項目名稱:tokalizer,代碼行數:8,代碼來源:func_multi.php

示例2: bar

 function bar()
 {
     print "calling foo statically:\n";
     foo::func();
     print "calling foo dynamically:\n";
     $foo = new foo();
     $foo->func();
     print "done\n";
 }
開發者ID:jenalgit,項目名稱:roadsend-php,代碼行數:9,代碼來源:bug-id-0001916.php

示例3: foo

 function foo($bla)
 {
     $array = array('key' => 'value', 'anotherKey' => 'anotherValue');
     echo 'foo';
     foo::foo($param1, $param2);
     $this->foo($param3, $param4);
     somefunc($param5, $param6);
 }
開發者ID:robo47,項目名稱:php-manipulator,代碼行數:8,代碼來源:output4.php

示例4: test

 public function test()
 {
     call_user_func(array('FOO', 'ABC'));
     call_user_func(array($this, 'ABC'));
     foo::XYZ();
     self::WWW();
     call_user_func('FOO::ABC');
 }
開發者ID:badlamer,項目名稱:hhvm,代碼行數:8,代碼來源:bug45180.php

示例5: mul

        echo "b = " . $this->b . "\n";
    }
    function mul()
    {
        return $this->a * $this->b;
    }
}
class bar extends foo
{
    public $c;
    function display()
    {
        /* alternative display function for class bar */
        echo "This is class bar\n";
        echo "a = " . $this->a . "\n";
        echo "b = " . $this->b . "\n";
        echo "c = " . $this->c . "\n";
    }
}
$foo1 = new foo();
$foo1->a = 2;
$foo1->b = 5;
$foo1->display();
echo $foo1->mul() . "\n";
echo "-----\n";
$bar1 = new bar();
$bar1->a = 4;
$bar1->b = 3;
$bar1->c = 12;
$bar1->display();
echo $bar1->mul() . "\n";
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:31,代碼來源:inheritance.php

示例6: func

    $d = 10;
    $d = func($a, $b);
    exit;
}
if ($which == 1) {
    /**
     * 返回引用示例1
     */
    class foo
    {
        public $value = 20;
        function &getValue()
        {
            return $this->value;
        }
    }
    $obj = new foo();
    $value =& $obj->getValue();
    // test 2:
    $obj->value = 30;
    echo $value;
    exit;
    // test 1:
    $value = 30;
    echo $obj->value;
    exit;
}
$a = '100';
$b =& $a;
$b = 200;
echo $a;
開發者ID:linjunjie,項目名稱:php-examples,代碼行數:31,代碼來源:&.php

示例7: as_string

<?php

class foo
{
    public $foo = 1;
    function as_string()
    {
        assert('$this->foo == 1');
    }
    function as_expr()
    {
        assert($this->foo == 1);
    }
}
$foo = new foo();
$foo->as_expr();
$foo->as_string();
開發者ID:badlamer,項目名稱:hhvm,代碼行數:17,代碼來源:bug23922.php

示例8: foo

{
    public $prop = 'a value';
    function foo($arg)
    {
        print "Constructor called on {$arg}\n";
    }
    function method()
    {
        print "Method called\n";
        return $this;
    }
    function method2()
    {
        print "Method 2 called\n";
        return $this;
    }
}
$foo = new foo('an argument');
$foo->method()->method();
// Can you do it on properties too?
print "property is :" . $foo->method()->prop . "\n";
$foo->method()->method2()->prop = 'newval';
print "property is :" . $foo->method()->method2()->prop . "\n";
// Don't forget the double-quoted string parser:
print "property is : {$foo->method()->prop}\n";
function afun()
{
    return new foo(22);
}
print afun()->prop;
print_r(afun()->method());
開發者ID:jenalgit,項目名稱:roadsend-php,代碼行數:31,代碼來源:retval-methodcall.php

示例9: baz

<?php

class foo
{
    static $bar = 123;
    static function baz()
    {
        return 456;
    }
}
echo foo::$bar;
// will print 123
echo foo::baz();
// will print 456
開發者ID:SandyS1,項目名稱:presentations,代碼行數:14,代碼來源:obj_static.php

示例10: testPublic

    {
        echo "Bar::testPrivate\n";
    }
}
class Foo extends Bar
{
    public function testPublic()
    {
        echo "Foo::testPublic\n";
    }
    private function testPrivate()
    {
        echo "Foo::testPrivate\n";
    }
}
$myFoo = new foo();
$myFoo->test();
// Bar::testPrivate
// Foo::testPublic
/**
Объекты одного типа имеют доступ к элементам с модификаторами private и protected друг друга,
даже если не являются одним и тем же экземпляром. Это объясняется тем, что реализация видимости
элементов известна внутри этих объектов.

Пример #3 Доступ к элементам с модификатором private из объектов одного типа
*/
class Test
{
    private $foo;
    public function __construct($foo)
    {
開發者ID:AntonBeletsky,項目名稱:LearnPHPdocs,代碼行數:31,代碼來源:Visibility.php

示例11: teste

 public function teste()
 {
     return foo::x(function &($a = 1, $b) {
     });
 }
開發者ID:badlamer,項目名稱:hhvm,代碼行數:5,代碼來源:call_user_func_005.php

示例12: array

0000727 


instantiate a class based on a classname from an array

<?php 
class foo
{
    var $directive = array('columnClass' => 'bar');
    function makeOne()
    {
        //create a new tableDefinition object
        $columnDef =& new $this->directive['columnClass']();
        $columnDef->zot();
    }
}
class bar
{
    function zot()
    {
        echo "they've spotted us\n";
    }
}
$afoo = new foo();
$afoo->makeOne();
?>
 	
開發者ID:jenalgit,項目名稱:roadsend-php,代碼行數:26,代碼來源:bug-id-0000727.php

示例13: array

[expect php]
[file]
<?php 
$f = 'c="foo"';
class foo
{
    const foobar = 1;
    public $pp = array('t' => null);
    function bar()
    {
        echo $this->t = 'f';
    }
    function __get($prop)
    {
        return $this->pp[$prop];
    }
    function __set($prop, $val)
    {
        echo "__set";
        $this->pp[$prop] = '';
    }
}
$f = new foo();
$f->bar();
?>
--EXPECT--
__setf
開發者ID:dw4dev,項目名稱:Phalanger,代碼行數:27,代碼來源:__set_data_corrupt.php

示例14: __call

<?php

class foo
{
    public function __call($a, $b)
    {
        print "non-static - ok\n";
    }
    public static function __callstatic($a, $b)
    {
        print "static - ok\n";
    }
}
$a = new foo();
$a->foooo();
$a::foooo();
$b = 'aaaaa1';
$a->{$b}();
$a::$b();
$b = '  ';
$a->{$b}();
$a::$b();
$b = str_repeat('a', 10000);
$a->{$b}();
$a::$b();
$b = NULL;
$a->{$b}();
開發者ID:badlamer,項目名稱:hhvm,代碼行數:27,代碼來源:objects_025.php

示例15: bar

<?php

class foo
{
    function bar()
    {
        var_dump(get_class());
    }
}
class foo2 extends foo
{
}
foo::bar();
foo2::bar();
$f1 = new foo();
$f2 = new foo2();
$f1->bar();
$f2->bar();
var_dump(get_class());
var_dump(get_class("qwerty"));
var_dump(get_class($f1));
var_dump(get_class($f2));
echo "Done\n";
開發者ID:badlamer,項目名稱:hhvm,代碼行數:23,代碼來源:009.php


注:本文中的foo類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。