Mother Function of A local variable
Moderator: General Moderators
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
Mother Function of A local variable
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
I mean
I have a local variable name
and i wanna know its from which function
- John Cartwright
- Site Admin
- Posts: 11470
- Joined: Tue Dec 23, 2003 2:10 am
- Location: Toronto
- Contact:
Re: Mother Function of A local variable
Like this: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
Code: Select all
function someFunc() {
$a = false;
}
echo containingFunctionOf('a'); // would echo 'someFunc'- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
Re: Mother Function of A local variable
Ya Like This but is containingFunctionOf really a function in phpWeirdan wrote:Code: Select all
function someFunc() { $a = false; } echo containingFunctionOf('a'); // would echo 'someFunc'
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?:Ya Like This but is containingFunctionOf really a function in php
Code: Select all
function someFunc() {
$a = false;
}
function someOtherFunc() {
$a = 'something';
}
echo containingFunctionOf('a'); // would it be 'someFunc'? or 'someOtherFunc'? maybe array('someFunc', 'someOtherFunc')?
Last edited by Weirdan on Wed Jan 03, 2007 1:34 pm, edited 1 time in total.
- neel_basu
- Forum Contributor
- Posts: 454
- Joined: Wed Dec 06, 2006 9:33 am
- Location: Picnic Garden, Kolkata, India
It would Return te function nameWeirdan wrote: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?:Ya Like This but is containingFunctionOf really a function in php
Code: Select all
function someFunc() { $a = false; } function someOtherFunc() { $a = 'something'; } echo containingFunctionOf('a'); // would it be 'someFunc'? or 'someOtherFunc'? maybe array('someFunc', 'someOtherFunc')?