LoginSignup
0
0

More than 3 years have passed since last update.

[PHP]実行中の関数名を取得する

Posted at

はじめに

業務で調べる機会があったので備忘録としてまとめました。

取得方法

実行中の関数は__FUNCTION__という定数に格納してある。

public function test() {
 echo __FUNCTION__;
}

出力結果

test

おまけ

__FUNCTION__のような使用する場所によって値が変化する定数(マジカル定数)は、PHP公式によれば9つ存在する。

0
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
0
0