HalfNote5 Posted March 6, 2013 Share Posted March 6, 2013 Inside a foreach/as loop, in a nested if loop I have this little nugget: else { $currentRec = current($r); echo "Rec to Kill: $currentRec"; //Testing purposes only - Killing the right thing? unset($r[$currentRec]); } It's not working as I'd expect it to (which would be to kill the current record of my 2d array). Of course, I'm a PHP novice, (more used to working with dbase/foxpro) so there's something in transitioning to PHP's logic that I'm most definitely missing. A nudge in the right direction would be lovely. Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/275331-unsettling-lack-of-results-from-unset/ Share on other sites More sharing options...
requinix Posted March 6, 2013 Share Posted March 6, 2013 current() returns a value, not a key. Use key() instead. Quote Link to comment https://forums.phpfreaks.com/topic/275331-unsettling-lack-of-results-from-unset/#findComment-1416974 Share on other sites More sharing options...
HalfNote5 Posted March 6, 2013 Author Share Posted March 6, 2013 You are my new best friend. Quote Link to comment https://forums.phpfreaks.com/topic/275331-unsettling-lack-of-results-from-unset/#findComment-1417010 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.