This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Test | |
{ | |
public function f1(array $keywords) | |
{ | |
foreach($keywords as $keyword) | |
{ | |
echo "f1():" . $keyword . "<br/>"; | |
} | |
} | |
public function f2(array $keywords) | |
{ | |
foreach($keywords as $keyword) | |
{ | |
echo "f2():" . $keyword . "<br/>"; | |
} | |
} | |
public function start() | |
{ | |
$this->run([$this, 'f1'], ['aaa', 'bbb']); | |
$this->run([$this, 'f2'], ['aaa', 'bbb']); | |
} | |
public function run($func, $args) | |
{ | |
$func($args); | |
} | |
} | |
$test = new Test(); | |
$test->start(); | |
// output | |
// f1():aaa | |
// f1():bbb | |
// f2():aaa | |
// f2():bbb |
No comments:
Post a Comment