本文整理汇总了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);
}
示例2: test_dynamic_new
function test_dynamic_new()
{
$f = new Foo();
$f->bar();
$k = "Foo";
$g = new $k();
$g->bar();
}
示例3: testChainedPropertyAssignmentExpressionHasExpectedEndLine
function testChainedPropertyAssignmentExpressionHasExpectedEndLine()
{
Foo::bar(__FUNCTION__)->baz(__FILE__)->value = 'FOOBAR';
}
示例4: Foo
<?php
require 'EventCallableObject.php';
EventCallableObject::pushDirectory('.');
$foo = new Foo();
echo $foo->bar(1, 2, 3);
示例5: testRuleNotAppliesToDynamicMethodCall
public function testRuleNotAppliesToDynamicMethodCall()
{
$foo = new Foo();
$foo->bar();
}
示例6: bar
<?php
class Foo
{
public static function bar()
{
echo "Hello";
}
}
// Instance level
$f = new Foo();
$f::bar();
// Class level
Foo::bar();
示例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();
示例8: bar
<?php
class Foo
{
public static function bar($x)
{
if ($x == 1) {
echo "hi";
}
}
}
Foo::bar(1);
Foo::bar(2);
示例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();
示例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');
示例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));
示例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);
示例13: testArgumentsContainsPropertyPostfixExpression
function testArgumentsContainsPropertyPostfixExpression()
{
Foo::bar(Bar::$baz);
}
示例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"));
示例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" );');