Hellihello
auch wenns gleich Haue gibt hierfür:
<?php
// testarray
$myArray["a"] = "va";
$myArray["b"] = "vb";
$myArray["c"] = "vc";
$myArray["aa"] = "vaa";
$myArray["bb"] = "vbb";
$myArray["cc"] = "vcc";
// get Iterator
$myArrayIterator = new ArrayIterator($myArray);
// will be numeric key of current entry for orientation
$seekKey = 0;
foreach ($myArrayIterator as $key => $value) {
// finish if end is reached
if ($myArrayIterator->count() <= $seekKey +1) {
return;
}
// there must be an "a" in the key-name
if (strpos($key,"a") !== false) {
// get value of next entriy using numeric key of actual position
$myArrayIterator->seek($seekKey + 1);
// output for test purpose
echo "next value: ";
echo $myArrayIterator->current();
echo "\n";
// go back to where we came from (thats the seekKey for too
$myArrayIterator->seek($seekKey);
}
// next numeric key for or
$seekKey++;
}
?>
Dank und Gruß,