Page 1 of 1

can i get the name of the array????

Posted: Wed Jun 27, 2007 11:29 am
by montyauto
i'm having lots of arrays with values and i have a funtion which does some operations based on the array passed as an argument..

(i.e) i want to check the name of the array and then do operations based on that.

So i want to get the name of the array passed into the funtion .

for eg:
if $cutomer = array('sefdsf','sdfsdf','sdfsdf');
i want to get the value 'customer'

is there any function to do this???

Posted: Wed Jun 27, 2007 11:32 am
by volka
There's no such function.

Posted: Wed Jun 27, 2007 11:39 am
by Gente
And why do you need it? Maybe there is more reasonable solution?

Posted: Wed Jun 27, 2007 1:14 pm
by mabufo
Perhaps you could make the first entry in the array whatever sort of identifier you need. You could simply iterate through the array with a conditional statement and go from there.

Posted: Wed Jun 27, 2007 1:19 pm
by RobertGonzalez
I think if you look in the comments of the print_r function manual page there may be something that someone has created that does this. I have code somewhere that does what you want because I needed it for something I was working on as well. If I find it, I will post it, but search the comments in the manual because I know someone has already written something that does what you are after.