Comment detail
メソッド名一覧の表示 (Nested Flatten)実行するとこが抜けてたorz
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | <?php
class Doukaku
{
function php()
{
print("php\n");
}
function test_php()
{
print("test_php\n");
}
function hello()
{
print("hello\n");
}
function test_hello()
{
print("test_hello\n");
}
}
$doukaku = new Doukaku();
$result = array();
foreach (get_class_methods($doukaku) as $method) {
if (strpos($method, "test_") === 0) {
$doukaku->$method();
}
}
?>
|
環境選びますがfnmatchとかいかがざんすか?
1 2 3 4 5 | foreach (get_class_methods($doukaku) as $method) {
if (fnmatch("test_*", $method)) {
$doukaku->$method();
}
}
|



halt #1465() [ PHP ] Rating0/0=0.00
Rating0/0=0.00-0+
1 reply [ reply ]