Reputation: 45
I have array:
$array = array('aaa', 'bbb', 333, 'ddd', 555, '666');
I would like remove all values where key is > 3;
How is the best way for this?
Upvotes: 1
Views: 153
Reputation: 17976
You can use foreach loop
foreach($array as $key => $image) {
if($value > 3) {
unset($array[$key]);
}
}
Upvotes: 3