Please consider this code :

<?php
$a = array("One","Two","Three");

foreach ($a AS $k=>$v) {
}

var_dump(current($a));
// outputs boll(false);

that's expected as foreach moves the internal array pointer, it's
documented.

now consider this :

<?php
$a = array("One","Two","Three");

foreach ($a AS $k=>$v) {
current($a);
}

var_dump(current($a));
// outputs string("One");

When using the internal pointer just by calling current() (so not moving
it), the output of the foreach loop has changed ...
Can someone explain that ?

regards.

Reply via email to