And converts everything to integer except string, so in php the post process could be:
public function key() {
$yourKey = $this->createYourKey();
if (is_object($yourKey) || is_array($yourKey))
throw new Exception('Array and Object not allowed.');
elseif (is_string($yourKey))
return $yourKey;
else
return (int) $yourKey;
}
Iterator::key
(PHP 5 >= 5.0.0)
Iterator::key — Gibt den Schlüssel des aktuellen Elements zurück
Beschreibung
abstract public scalar Iterator::key
( void
)
Gibt den Schlüssel des aktuellen Elements zurück.
Parameter-Liste
Diese Funktion hat keine Parameter.
Rückgabewerte
Gibt bei Erfolg einen Skalar zurück, im Fehlerfall wird NULL zurückgegeben.
Fehler/Exceptions
Wirft im Fehlerfall eine Meldung vom Typ E_NOTICE.
Lszl Lajos Jnszky ¶
1 year ago
