If you do current() after using uset() on foreach statement, you can get FALSE in PHP version 5.2.4 and above.There is example:<?php$prices = array(0 => '1300990',1 => '500',2 => '600');foreach($prices as $key => $price){ if($price < 1000){ unset($prices[$key]); }}

var_dump(current($prices)); // bool(false)?>If you do unset() without foreach? all will be fine.<?php$prices = array(0 => '1300990',1 => '500',2 => '600');unset($prices[1]);unset($prices[2]);

The docs do not specify this, but adding to the array using the brackets syntax:
<?php $my_array[] = $new_value; ?>
will not advance the internal pointer of the array. therefore, you cannot use current() to get the last value added or key() to get the key of the most recently added element.

You should do an end($my_array) to advance the internal pointer to the end ( as stated in one of the notes on end() ), then

It took me a while to figure this out, but there is a more consistent way to figure out whether you really went past the end of the array, than using each().

You see, each() gets the value BEFORE advancing the pointer, and next() gets the value AFTER advancing the pointer. When you are implementing the Iterator interface, therefore, it's a real pain in the behind to use each().

And thus, I give you the solution:To see if you've blown past the end of the array, use key($array) and see if it returns NULL. If it does, you're past the end of the array -- keys can't be null in arrays.

Nifty, huh? Here's how I implemented the Iterator interface in one of my classes: