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 Quote Link to comment 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]); } Quote Link to comment Share on other sites More sharing options...
dsp77 Posted August 27, 2011 Author Share Posted August 27, 2011 thank you, the unset was missing 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.