dsp77 Posted August 27, 2011 Share Posted August 27, 2011 Hello, i have an array like: Array ( [0] => http://www.google.com/asdasfsdafas [1] => http://www.google.com/join.html [2] => http://www.google.com/dfsgjkd [3] => http://www.google.com/join.html [4] => http://www.google.com/ddfgyyhujh [5] => http://www.google.com/join.html [6] => http://www.google.com/ghklkl ) I'm trying to transform it like: Array ( [0] => http://www.google.com/asdasfsdafas [1] => http://www.google.com/dfsgjkd [2] => http://www.google.com/ddfgyyhujh [3] => http://www.google.com/ghklkl ) I used array_fliter but with no success any advise? Thanks Link to comment https://forums.phpfreaks.com/topic/245818-help-skipping-array-odd-key/ Share on other sites More sharing options...
.josh Posted August 27, 2011 Share Posted August 27, 2011 foreach ($array as $k => $v) { if ($k % 2 != 0) unset($array[$k]); } Link to comment https://forums.phpfreaks.com/topic/245818-help-skipping-array-odd-key/#findComment-1262600 Share on other sites More sharing options...
dsp77 Posted August 27, 2011 Author Share Posted August 27, 2011 thank you, the unset was missing Link to comment https://forums.phpfreaks.com/topic/245818-help-skipping-array-odd-key/#findComment-1262613 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.