Home >Backend Development >PHP Tutorial >The file name where the php detection function is located

The file name where the php detection function is located

巴扎黑
巴扎黑Original
2016-11-22 16:07:061306browse

A very simple function, using the reflection mechanism in PHP, specifically using the ReflectionFunction class, to obtain the specific location in the PHP script where the specified function is located. Create a reference script.

// Filename: functions.php 
<?php
function now() {
    return time();
}
?>

Call the function.

// Filename: call_now.php
<?php
require &#39;functions.php&#39;;
 
Reflection::export(new ReflectionFunction(&#39;now&#39;));
// Function [ function now ] { @@ H:\www\functions.php 2 - 4 }
?>


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:PHP output erect pyramidNext article:PHP output erect pyramid