Page 1 of 1

check whether a function is called??

Posted: Thu May 17, 2012 10:26 am
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???

Re: check whether a function is called??

Posted: Thu May 17, 2012 10:59 am
by requinix
Is called or is defined? For the former no, for the latter yes.

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:08 am
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;

}

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:13 am
by Celauran
What are you trying to do?

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:18 am
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.

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:19 am
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?

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:23 am
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

Re: check whether a function is called??

Posted: Thu May 17, 2012 11:24 am
by Celauran