t_machine Posted September 19, 2007 Share Posted September 19, 2007 Hi, I am wondering if anyone can help with this problem. I would like to get only the first key and value from my array. Example $myarray = array('linkname1'=>'linkurl', 'linkname2'=>'linkurl2', 'linkname3'=>'linkurl3'); What I would like is to get only the first "linkname1" and "linkurl" It will be use in my codes -> <a href="linkurl">linkname1</a> Thanks for any help Quote Link to comment Share on other sites More sharing options...
BlueSkyIS Posted September 19, 2007 Share Posted September 19, 2007 $keys = array_keys($myarray); $key1 = $keys[0]; $value1 = $myarray[$key1]; Quote Link to comment Share on other sites More sharing options...
t_machine Posted September 19, 2007 Author Share Posted September 19, 2007 Thank you very much It works perfectly 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.