Gibt es einen Unterschied zwischen
for ($i = 0; $i < count($typname); $i++) {
echo $typname[$i];
}
>
> und
>
> ~~~php
foreach ($typname as $value) {
> echo $value;
> }
?
http://de.php.net/manual/de/control-structures.foreach.php:
Hinweis: When foreach first starts executing, the internal array pointer is automatically reset to the first element of the array. This means that you do not need to call reset() before a foreach loop.
Hinweis: Unless the array is referenced, foreach operates on a copy of the specified array and not the array itself. foreach has some side effects on the array pointer. Don't rely on the array pointer during or after the foreach without resetting it.