function main() { $obja = new A(); $obja->entry(); A::static_entry(); call_user_func('A::foo'); call_user_func(array('A', 'foo')); call_user_func(array($obja, 'foo')); // raises warning; no call to __callStatic caller(); }
public function commit() { error_log(caller(true) . " called " . get_class($this) . "->commit(), should use ->save()"); return $this->save(); }
/** * The testing controller runs test cases by calling this method on its $app * * @param String $desc a description of the test * @param Boolean $passed whether the test passed * @param Object $test_data the data used in the test (optional) * @param String $method the method that is running tests (optional) */ public function test_case($desc, $passed, $test_data = NULL, $method = NULL) { if (!$method) { $method = caller(2, 'function'); } $this->test_run->add_test_case($desc, !!$passed, $test_data, $method); }
*/ /** * @param $n * * @return int */ function fibonacciRecursive($n) { if ($n == 0) { return 0; } elseif ($n == 1) { return 1; } else { return fibonacciRecursive($n - 1) + fibonacciRecursive($n - 2); } } /** * @param $n * * @return int */ function caller($number) { echo "Fibonacci series recursive: "; for ($i = 0; $i < $number; $i++) { echo fibonacciRecursive($i) . ' '; } echo "<br><br>"; } caller(10);