Page 2 of 3
Posted: Wed Jan 03, 2007 2:43 pm
by John Cartwright
The Ninja Space Goat wrote:what's the deal with this response?

To hug php While playing With it
You've said that in a few threads... what does that mean??

To be honest I don't understand some things neel_basu sais, so a little piece of advise to ya neel_basu: please try to be as
concise and
thorough as possible. I understand english may not be your native tongue, so when you are brief and unspecific the language barrier grows.
Posted: Wed Jan 03, 2007 11:35 pm
by neel_basu
I was joaking

Actually I learnt php While playing with it
And I love it
and so
If php is a female human being

i wanna get a hug from her.
I think hug is an English Word.
Posted: Wed Jan 03, 2007 11:40 pm
by neel_basu
OK But anybody knows te answer of my question ??
Please Reply.
Posted: Wed Jan 03, 2007 11:44 pm
by volka
There's no such thing in php. You might write your own parser - but somehow I doubt that's what you want.
Posted: Wed Jan 03, 2007 11:50 pm
by neel_basu
OK Thanks I've got my Answer
My Question was
How to Get the a variable's mother function's name from a that variable name
Posted: Thu Jan 04, 2007 12:42 am
by dibyendrah
Weird question. I've not tried yet. Sounds interesting but not what's the use of doing this ?
Posted: Thu Jan 04, 2007 1:08 am
by neel_basu
dibyendrah wrote:what's the use of doing this ?
Playing
Posted: Thu Jan 04, 2007 1:35 am
by John Cartwright
neel_basu wrote:dibyendrah wrote:what's the use of doing this ?
Playing
I'm sure you could be more creative than this if your after "fun" activities

Re: Mother Function of A local variable
Posted: Thu Jan 04, 2007 2:24 am
by Christopher
neel_basu wrote:Can We know In which function does a local variable is staying just with its name.
I mean
I have a local variable name
and i wanna know its from which function
It is a question that shows a wonderful depth of misunderstanding. Obviously because multiple functions can have local vars with the same name you couldn't get a definitive answer even from a parser that parsed the script. If you "have" (the word "have" has no real technical meaning) a local variable name then you can only really be in the function in which it exists, therefore __FUNCTION__ would work without even having the name.
Posted: Thu Jan 04, 2007 3:26 am
by neel_basu
Ya I've Got The idea In My Mind.We Can Do it
We Can Create A Funcion That Will Treat $_SERVER["PHP_SELF"] as a Text file
and search for the Variable name in it.
And Store the line number (s) of its occurences in an Array ( Suppose $arr_var ) descending
and Then search for the string "function" And store the line number (s) of its occurences in an another array ( Suppose $arr_func ) descending
As Occurences of one variable in a Function may be 1 or many so
in a for loop it Would first hold the $arr_var[$i] and then start another loop
for($j=0;$j<=$arr_var[$i];$j++) And Find the nearest line number ( nearest with $arr_var[$i] ).
And In that line The mother Function Stayes
So Now we will find the String after "function " and before "(" and trim() it To get The Function name
and that function would take the variable name (as string) as argument
and make output of the name of the function(s) (as string) if more than 1 function names are found it would use a separater as "-" or "," and return the string
( We Can explode it latter fo further use )
Posted: Thu Jan 04, 2007 6:13 am
by aaronhall
I think you just built a parser that parses the output of the same parser it uses to parse that parsers output. It won't output the parent function, but it'll probably time travel or something.
Posted: Thu Jan 04, 2007 6:18 am
by neel_basu
aaronhall wrote:I think you just built a parser that parses the output of the same parser it uses to parse that parsers output. It won't output the parent function, but it'll probably time travel or something.
It would Use fopen() to open the File And fread() to read it So It Would Not Parse The output
Posted: Thu Jan 04, 2007 6:19 am
by dibyendrah
php developers might know better.
Why are you exploring this issue ?

Posted: Thu Jan 04, 2007 6:26 am
by aaronhall
neel_basu wrote:aaronhall wrote:I think you just built a parser that parses the output of the same parser it uses to parse that parsers output. It won't output the parent function, but it'll probably time travel or something.
It would Use fopen() to open the File And fread() to read it So It Would Not Parse The output
I was just trying to make my brain implode. I really don't know why you would ever use a function like that -- the variable wouldn't even exist in the scope you're calling the function from.
Posted: Thu Jan 04, 2007 6:30 am
by neel_basu
I have decleared The Cause above