LoginSignup
1
0

More than 5 years have passed since last update.

可変関数の小さなサンプル

Posted at

コード

test.php
<?php

function test1(){
        echo "test1".PHP_EOL;
}

function test2(){
        echo "test2".PHP_EOL;
}

$func = "test1";
$func();
$func = "test2";
$func();

結果

$ php test.php
test1
test2
1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0