tarun Posted February 7, 2007 Share Posted February 7, 2007 I Had Help With This Yesturday And Now I Need Some More This Is My Example Code $friendList = array(); $friendList["Lisa"] = "offline"; $friendList["Jack"] = "online"; $friendList["Ryan"] = "offline"; $friendList["Rachel"] = "offline"; $friendList["Grace"] = "online"; foreach( $friendList as $key => $value){ echo "Friend: $key, Status: $value"; } How Would I Change The Values (offline, online etc.)? Thnx, Tarun Quote Link to comment Share on other sites More sharing options...
Balmung-San Posted February 7, 2007 Share Posted February 7, 2007 And I'm back again to help you. w00t! It's pretty simple actually, just: $friendList["name_here"] = "status_here"; Dynamic: $friendList[$name_to_remove] = $some_status_var; Since you're doing all this array stuff, I suggest you take a look at the PHP Array Docs. Quote Link to comment Share on other sites More sharing options...
tarun Posted February 7, 2007 Author Share Posted February 7, 2007 Thnx - AGAIN For Your Help And For The Link Tarun Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted February 7, 2007 Share Posted February 7, 2007 Like this: <?php $friendList = array(); $friendList["Lisa"] = "offline"; $friendList["Jack"] = "online"; $friendList["Ryan"] = "offline"; $friendList["Rachel"] = "offline"; $friendList["Grace"] = "online"; $friend = 'Lisa'; if(array_key_exists($friend,$friendList)){ $friendList[$friend] = 'Online'; } foreach( $friendList as $key => $value){ echo "Friend: $key, Status: $value <br>"; } ?> 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.