JREAM Posted December 12, 2009 Share Posted December 12, 2009 I have this: $arrForms['title'] I want like to get: title Basically so I can check a field, and also the output will tell me the name of the array piece. Quote Link to comment Share on other sites More sharing options...
rajivgonsalves Posted December 12, 2009 Share Posted December 12, 2009 there are many ways to do this consider this <?php $arrForms['title'] = 'test'; echo key($arrForms); ?> Quote Link to comment Share on other sites More sharing options...
JREAM Posted December 12, 2009 Author Share Posted December 12, 2009 thank you Quote Link to comment Share on other sites More sharing options...
Andy-H Posted December 12, 2009 Share Posted December 12, 2009 You could use foreach foreach( $arrForms ad $k => $val ) { // $k = array key... } or you could use array_keys $keys = array_keys($arrForms); reset($keys); while ($key = current($keys)) { // $key = array key... next($key); } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.