How to get the function name inside a function in php?
To get the function name inside the PHP function we need to use Magic constants(__FUNCTION__).
1. Code:
2. Example:
Input:
function Soltuts()
Output:
The function name: Soltuts
3. Syntax:
Syntax:
$string = __FUNCTION__
Description: This constant is used to return the function name, or {closure} for anonymous functions.
To get the function name inside the PHP function we need to use Magic constants(FUNCTION) or Magic constants(METHOD).
Magic constants: Magic constants are the predefined constants in PHP which is used on the basis of their use. These constants are starts and end with a double underscore (__). These constants are created by various extensions.