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


PHP Foo::bar方法代碼示例

本文整理匯總了PHP中Foo::bar方法的典型用法代碼示例。如果您正苦於以下問題:PHP Foo::bar方法的具體用法?PHP Foo::bar怎麽用?PHP Foo::bar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Foo的用法示例。


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

示例1: testPhpError

 /**
  * This test function contains a code which will
  * create a php warning to happen. This eample show 
  * that in phpunit it will treated as an exception and 
  * it could be catched by 'expectedException' tag and 
  * exception name would be 'PHPUnit_Framework_Error'
  * 
  * @expectedException PHPUnit_Framework_Error
  */
 public function testPhpError()
 {
     $foo_obj = new Foo();
     # Line below will throw an exception here only
     $foo_obj->bar();
     # Code execution will never reach this point
     $this->assertTrue(true);
 }
開發者ID:p-ja,項目名稱:phpunit-examples,代碼行數:17,代碼來源:09TestPhpErrors.php

示例2: test_dynamic_new

function test_dynamic_new()
{
    $f = new Foo();
    $f->bar();
    $k = "Foo";
    $g = new $k();
    $g->bar();
}
開發者ID:badlamer,項目名稱:hhvm,代碼行數:8,代碼來源:dynamic_new.php

示例3: testChainedPropertyAssignmentExpressionHasExpectedEndLine

function testChainedPropertyAssignmentExpressionHasExpectedEndLine()
{
    Foo::bar(__FUNCTION__)->baz(__FILE__)->value = 'FOOBAR';
}
開發者ID:kingsj,項目名稱:core,代碼行數:4,代碼來源:testChainedPropertyAssignmentExpressionHasExpectedEndLine.php

示例4: Foo

<?php

require 'EventCallableObject.php';
EventCallableObject::pushDirectory('.');
$foo = new Foo();
echo $foo->bar(1, 2, 3);
開發者ID:hackoh,項目名稱:EventCallableObject,代碼行數:6,代碼來源:index.php

示例5: testRuleNotAppliesToDynamicMethodCall

 public function testRuleNotAppliesToDynamicMethodCall()
 {
     $foo = new Foo();
     $foo->bar();
 }
開發者ID:flavius,項目名稱:phpmd,代碼行數:5,代碼來源:testRuleNotAppliesToDynamicMethodCall.php

示例6: bar

<?php

class Foo
{
    public static function bar()
    {
        echo "Hello";
    }
}
// Instance level
$f = new Foo();
$f::bar();
// Class level
Foo::bar();
開發者ID:TechnoBotz,項目名稱:hack-hhvm-docs,代碼行數:14,代碼來源:hack.unsupported8.php

示例7: __call

<?php

class Foo
{
    public function __call($method, $args)
    {
        if (isset($this->{$method})) {
            $func = $this->{$method};
            $func($args);
        }
    }
}
$foo = new Foo();
$foo->bar = function () {
    echo "Hello, this function is added at runtime";
};
$foo->bar();
開發者ID:sdgdsffdsfff,項目名稱:qconf-inner,代碼行數:17,代碼來源:test_autoload.php

示例8: bar

<?php

class Foo
{
    public static function bar($x)
    {
        if ($x == 1) {
            echo "hi";
        }
    }
}
Foo::bar(1);
Foo::bar(2);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:13,代碼來源:if.php

示例9: __construct

<?php

class Foo
{
    private $test;
    public function __construct($test)
    {
        $this->test = $test;
    }
    public function bar()
    {
        return strrev($this->test);
    }
}
$foo = new Foo('Hello world');
return $foo->bar();
開發者ID:kegi,項目名稱:dictionary,代碼行數:16,代碼來源:reversed_word_class.php

示例10: bar

<?php

namespace HHVM\UserDocumentation\Inconsistencies\Intro\Examples\LVP;

class Foo
{
    function bar($baz)
    {
        $baz = 'herpderp';
        // Always outputs array('herpderp')
        var_dump(func_get_args());
    }
}
$f = new Foo();
$f->bar('blah');
開發者ID:Daniel15,項目名稱:hhvm-docs,代碼行數:15,代碼來源:local-var-param.php

示例11: bar

<?php

class Foo
{
    public $x = 0;
    function bar()
    {
        return function () {
            return $this->x;
        };
    }
}
$foo = new Foo();
$qux = $foo->bar();
$foobar = new Foo();
$foobar->x = 3;
var_dump($qux());
var_dump($qux->call($foo));
// Try on an object other than the one already bound
var_dump($qux->call($foobar));
// Pass a non-object as the parameter for binding the closure to.
// Will get a warning
var_dump($qux->call(4));
var_dump($qux->call(null));
$bar = function () {
    return $this->x;
};
$elePHPant = new StdClass();
$elePHPant->x = 7;
// Try on a StdClass
var_dump($bar->call($elePHPant));
開發者ID:badlamer,項目名稱:hhvm,代碼行數:31,代碼來源:call-detailed.php

示例12: bar

<?php

class Foo
{
    public static function bar($x)
    {
        if ($x == 1) {
            echo "hi";
        } else {
            if ($x == 2) {
                echo "hello";
            } else {
                echo "uhhh";
            }
        }
    }
}
Foo::bar(1);
Foo::bar(2);
Foo::bar(3);
開發者ID:badlamer,項目名稱:hhvm,代碼行數:20,代碼來源:if_elseif_else.php

示例13: testArgumentsContainsPropertyPostfixExpression

function testArgumentsContainsPropertyPostfixExpression()
{
    Foo::bar(Bar::$baz);
}
開發者ID:kingsj,項目名稱:core,代碼行數:4,代碼來源:testArgumentsContainsPropertyPostfixExpression.php

示例14: bar

<?php

class Alliteration
{
    public $firstAllit = "cast vicariously as both victim and villain";
    public $clause = array('part1' => 'no mere veneer of vanity');
    public $nested = array(array("is a vestige of the", "vox populi", "now vacant"));
}
class Foo
{
    public function bar($bag_of_stuff)
    {
        echo 'some
    embedded
    newlines';
        echo "\n";
        echo 'Arnold once said: "I\'ll be back"';
        echo "\n";
        $v = "Voila! ";
        $all = new Alliteration();
        echo "{$v} In view humble vaudevillian veteran" . "{$all->firstAllit} {$bag_of_stuff['0']}.\n";
        echo "This visage, {$all->clause['part1']}, " . "{$all->nested[0][0]} \"{$all->nested[0][1]}\"" . " {$all->nested[0][2]}\n";
    }
}
$f = new Foo();
$f->bar(array("by the vicissitudes of fate"));
開發者ID:jeremyadoux,項目名稱:hhvm,代碼行數:26,代碼來源:string_interpolation.php

示例15: bar

<?php

class Foo
{
    var $bar = "bar";
    function bar($what)
    {
        echo "I'm a ", $what, "!\n";
    }
}
$foo = new Foo();
echo $foo->bar, "\n";
$foo->bar("function");
$v8 = new V8Js();
$v8->foo = new Foo();
$v8->executeString('print(PHP.foo.$bar, "\\n");');
$v8->executeString('PHP.foo.__call("bar", ["function"])');
// // Hello, v8
// class Foo {
//     var $bar = null;
// }
//
// $v8 = new V8Js();
// $v8->foo = new Foo;
// $v8->executeString('print( "bar" in PHP.foo ? "yes" : "no" );');
開發者ID:hyunju38,項目名稱:sample-react-php-v8js,代碼行數:25,代碼來源:hello-v8.php


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