PHP_Framework

Wh1t3projects' PHP framework. Small PHP framework for building web apps and websites

View the Project on GitHub

Syntax: kernel_getCaller([int $depth])

Get the function name that called the current function


Parameters

Optional depth
Specify how much we should go deeper. For example, if we want to get the parent of the function that called the current one, we can use 1. We could also get the parent of the parent by using 2.


Return values

Name of the caller function as a string


Examples:

Show the caller function name

function test() {
test2();
}
function test2() {
echo kernel_getCaller(); // Will show 'test'
}

Get and show the parent function name

function parent() {
test();
}
function test() {
test2();
}
function test2() {
$parent = kernel_getCaller(1);
echo $parent; // Will show "parent"
}