tvance929 Posted March 3, 2009 Share Posted March 3, 2009 Sorry to be a bother --- I just found out that I could get the last element of an associative array via the end() function. thats great...the reason I was getting that was because I wanted to see if the incoming number was higher than that last number (I have already sorted)... Now I am stuck on my next step and that is Killing that element if it is lower than the incoming one. my stab was this: elseif ($score > end($scoresArray)) { unset(end($scoresArray)); } but that broke. :'( any help? Quote Link to comment https://forums.phpfreaks.com/topic/147782-solved-how-to-delete-last-element-of-associative-array-unset/ Share on other sites More sharing options...
Maq Posted March 3, 2009 Share Posted March 3, 2009 array_pop() Quote Link to comment https://forums.phpfreaks.com/topic/147782-solved-how-to-delete-last-element-of-associative-array-unset/#findComment-775723 Share on other sites More sharing options...
tvance929 Posted March 3, 2009 Author Share Posted March 3, 2009 holy crap! are you serious...? nice! Quote Link to comment https://forums.phpfreaks.com/topic/147782-solved-how-to-delete-last-element-of-associative-array-unset/#findComment-775727 Share on other sites More sharing options...
Maq Posted March 3, 2009 Share Posted March 3, 2009 holy crap! are you serious...? nice! I'm serious kind of guy... Lol yeah of course I'm serious, there's usually an easier way of doing something. Quote Link to comment https://forums.phpfreaks.com/topic/147782-solved-how-to-delete-last-element-of-associative-array-unset/#findComment-775739 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.