当前位置: 首页>>代码示例>>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;未经允许,请勿转载。