User Name Password Register
DaniWeb IT Discussion Community
All
What is DaniWeb IT Discussion Community?
You're currently browsing the PHP section within the Web Development category of DaniWeb, a massive community of 423,399 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 4,496 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our PHP advertiser: Lunarpages PHP Web Hosting
Views: 536 | Replies: 1
Reply
Join Date: Jan 2006
Location: Boston, MA
Posts: 5
Reputation: metaface is an unknown quantity at this point 
Rep Power: 0
Solved Threads: 0
metaface metaface is offline Offline
Newbie Poster

Question Determine in which file a user function is defined?

  #1  
Aug 7th, 2007
Hello,

I am familiar with the get_defined_functions() function as a way of listing all of the user defined functions.

Is there a way with PHP to also determine from which file the user function was defined?

Consider the following example. Assume there are three files:
- index.php
- user_functions1.inc.php
- user_functions2.inc.php

contents of user_functions1.inc.php:
<?php
function example_function1() {
    print "hello world 1";
}
?>

contents of user_functions2.inc.php:

<?php
function example_function2() {
    print "hello world 2";
}
?>

contents of index.php:
<?php
include(user_functions1.inc.php);
include(user_functions2.inc.php);
$functions = get_defined_functions();
$user_functions = $functions['user'];
foreach($user_functions as $function) {
	print "$function<br>";
}
?>

output of index.php:
example_function1
example_function2

I would like to use PHP to determine that user function example_function1 was defined in the file user_functions1.inc.php

Is this possible?

Thank you.

Dave
AddThis Social Bookmark Button
Reply With Quote  
Join Date: Dec 2006
Location: syria
Posts: 158
Reputation: w_3rabi is an unknown quantity at this point 
Rep Power: 2
Solved Threads: 8
w_3rabi's Avatar
w_3rabi w_3rabi is offline Offline
Junior Poster

Re: Determine in which file a user function is defined?

  #2  
Aug 27th, 2007
i guess u should do it on each file
programming is an art ,only for those who can understand it.
- th3 php wr3nch -
Reply With Quote  
Reply

Only community members can participate in forum threads. You must register or log in to contribute.

DaniWeb PHP Marketplace
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)

 

Thread Tools Display Modes

Similar Threads
Other Threads in the PHP Forum

All times are GMT -4. The time now is 1:13 pm.
Forum system based on vBulletin Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
©2003 - 2008 DaniWeb® LLC