check whether a function is called??

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

check whether a function is called??

Post by azycraze »

in php there is a way to check whether a function exists or not in a page.
My question is..
Is there any way or predefined function to check whether a function is called or not in a page???
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: check whether a function is called??

Post by requinix »

Is called or is defined? For the former no, for the latter yes.
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: check whether a function is called??

Post by azycraze »

is there any possibility of creating my own function to check whether is called or not?
something like

function is_function_called($function_name,$page_url,$called='true')
{
// lines of code

if($called)
return true ;
else
return false;

}
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: check whether a function is called??

Post by Celauran »

What are you trying to do?
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: check whether a function is called??

Post by azycraze »

i have a php page A which include another page B if valid.
B is valid only if it calls a specific function.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: check whether a function is called??

Post by Celauran »

So you could read in B as a string, check for the presence of that function call using substrings or regex, then include or not accordingly, no? Still doesn't feel like a particularly good solution, mind you. The problem itself seems a little strange. Are you including pages dynamically?
Last edited by Celauran on Thu May 17, 2012 11:24 am, edited 1 time in total.
User avatar
azycraze
Forum Commoner
Posts: 56
Joined: Mon Oct 24, 2011 12:08 pm
Location: India

Re: check whether a function is called??

Post by azycraze »

thanks for the quick reply.
i m not good in file handling.
so will you please guide me to some useful links??
plss
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: check whether a function is called??

Post by Celauran »

Post Reply