Page 1 of 3
Mother Function of A local variable
Posted: Wed Jan 03, 2007 12:43 pm
by neel_basu
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
Posted: Wed Jan 03, 2007 12:50 pm
by Weirdan
Why would you like to know that?
Posted: Wed Jan 03, 2007 12:50 pm
by John Cartwright
huh?

Posted: Wed Jan 03, 2007 12:55 pm
by neel_basu
Weirdan wrote:Why would you like to know that?

To hug php While playing With it

If Somebody Have the answer Pls tell me
Re: Mother Function of A local variable
Posted: Wed Jan 03, 2007 12:57 pm
by Weirdan
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
Like this:
Code: Select all
function someFunc() {
$a = false;
}
echo containingFunctionOf('a'); // would echo 'someFunc'
?
Re: Mother Function of A local variable
Posted: Wed Jan 03, 2007 1:00 pm
by neel_basu
Weirdan wrote:
Code: Select all
function someFunc() {
$a = false;
}
echo containingFunctionOf('a'); // would echo 'someFunc'
Ya Like This but is containingFunctionOf really a function in php
Posted: Wed Jan 03, 2007 1:18 pm
by Weirdan
Ya Like This but is containingFunctionOf really a function in php
considering that was a question, the answer is 'no'. I'm just speculating here to see if it could be implemented at all.
What would this imaginary function return when used in the following snippet?:
Code: Select all
function someFunc() {
$a = false;
}
function someOtherFunc() {
$a = 'something';
}
echo containingFunctionOf('a'); // would it be 'someFunc'? or 'someOtherFunc'? maybe array('someFunc', 'someOtherFunc')?
Posted: Wed Jan 03, 2007 1:20 pm
by neel_basu
Well Do You Know a function that can do this job
Posted: Wed Jan 03, 2007 1:25 pm
by Weirdan
Unless you have definitive answer to my previous question I'm not even sure if such a function could exist.
Posted: Wed Jan 03, 2007 1:48 pm
by neel_basu
Weirdan wrote:
Ya Like This but is containingFunctionOf really a function in php
considering that was a question, the answer is 'no'. I'm just speculating here to see if it could be implemented at all.
What would this imaginary function return when used in the following snippet?:
Code: Select all
function someFunc() {
$a = false;
}
function someOtherFunc() {
$a = 'something';
}
echo containingFunctionOf('a'); // would it be 'someFunc'? or 'someOtherFunc'? maybe array('someFunc', 'someOtherFunc')?
It would Return te function name
Posted: Wed Jan 03, 2007 1:54 pm
by Weirdan
It would Return te function name
what function exactly? there are two functions defined, both have the $a variable in their local scope (in other words, two different variables named $a exists, one belonging to someFunc's scope and other belonging to someOtherFunc's scope).
Posted: Wed Jan 03, 2007 1:55 pm
by neel_basu
The someOtherFunc()
Posted: Wed Jan 03, 2007 2:02 pm
by Weirdan
and why not 'someFunc' then?
Posted: Wed Jan 03, 2007 2:06 pm
by neel_basu
1st do That one Then The previous one. Cause i dont need Any True false variable's mother function
Posted: Wed Jan 03, 2007 2:07 pm
by Luke
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??
