Every time I write a peace of PHP code, to perform database activity or calculations, I’m curious about how many files are included, by framework (CodeIgniter,Yii, Zend etc.).
My moto is, just don’t want to include those files, which are not taking any part in my logic, like if I am not doing any database activity, I don’t want to include database connection file.
PHP, know them all. It has function which give me list of that.
http://php.net/manual/en/function.get-included-files.php
get_included_files() — Returns an array with the names of included or required files
alias get_required_files()
we can check it with below code,
<?php
$includedFiles = get_included_files();
$i=1;
foreach ($includedFiles as $filename) {
echo $i++.’) ‘.$filename.'<br />’;
}
die;
?>
How to get php functions & public user defined functions?
http://php.net/manual/en/function.get-defined-functions.php
get_defined_functions() – Returns an array of all defined functions
It returns array([internal]=>(….),[user]=>(….))
<?php
$arr = get_defined_functions();
echo ‘<pre>’; print_r($arr);
die;
?>
Comments/Suggestions are always welcome.
about