![]() |
Feature request - simple function to get variable name as a string - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived General Discussion (https://forum.codeigniter.com/forumdisplay.php?fid=21) +--- Thread: Feature request - simple function to get variable name as a string (/showthread.php?tid=39934) |
Feature request - simple function to get variable name as a string - El Forum - 03-24-2011 [eluser]adityamenon[/eluser] Currently, I'm using a custom helper with this code. But, I think this a necessary function that codeigniter needs to have built in, and loaded automatically... submitted for the kind consideration of the admins for inclusion in the next iteration of CI. Feature request - simple function to get variable name as a string - El Forum - 03-25-2011 [eluser]WanWizard[/eluser] Can you give an example (in code) of where you would like to know the name of a variable, but you don't? I can't imagine needing a function like this... Feature request - simple function to get variable name as a string - El Forum - 03-25-2011 [eluser]adityamenon[/eluser] I regret posting this request now. Indeed, Wizard, you are right, there is no situation where this would be needed. I was going to use this for inserting TRUE/FALSE values into a database depending on whether or not a corresponding checkbox was ticked. I thought this would be necessary, but I could achieve the same with a simple foreach $key = $value construct. Sorry for wasting all of your time. Still though, the code I was about to use was: Code: <?php It's in the PHP manual. Feature request - simple function to get variable name as a string - El Forum - 03-25-2011 [eluser]WanWizard[/eluser] I saw the code, I just struggled to find a practical application, hence the question. |