How to get list of files included in PHP.??

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

Advertisements

PHP Developer..

Posted in PHP
One comment on “How to get list of files included in PHP.??
  1. amazing article, make me like to read it. thanks i’ll try at home

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: