ChaosXero Posted August 13, 2006 Share Posted August 13, 2006 I have an array I'm using for errors and I'd like it to output the name of the array section i.e. array error() = username = 1I want to output Bad 'Username!' (told to do so because username = 1) I just need to know what to do to output the 'name' of an item in an array. Hope this makes sense. Quote Link to comment Share on other sites More sharing options...
trq Posted August 13, 2006 Share Posted August 13, 2006 Does this help?[code=php:0]foreach ($error as $k => $v) { if ($k == 'username' && $v == 1) { echo "Bad $k!"; }}[/code] 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.