ArrayIterator::current

(PHP 5, PHP 7, PHP 8)

ArrayIterator::currentReturn current array entry

Beschreibung

public ArrayIterator::current(): mixed

Get the current array entry.

Parameter-Liste

Diese Funktion besitzt keine Parameter.

Rückgabewerte

The current array entry.

Beispiele

Beispiel #1 ArrayIterator::current() example

<?php
$array
= array('1' => 'one',
'2' => 'two',
'3' => 'three');

$arrayobject = new ArrayObject($array);

for(
$iterator = $arrayobject->getIterator();
$iterator->valid();
$iterator->next()) {

echo
$iterator->key() . ' => ' . $iterator->current() . "\n";
}
?>

Das oben gezeigte Beispiel erzeugt folgende Ausgabe:

1 => one
2 => two
3 => three

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top

Follow Lee on X/Twitter - Father, Husband, Serial builder creating AI, crypto, games & web tools. We are friends :) AI Will Come To Life!

Check out: eBank.nz (Art Generator) | Netwrck.com (AI Tools) | Text-Generator.io (AI API) | BitBank.nz (Crypto AI) | ReadingTime (Kids Reading) | RewordGame | BigMultiplayerChess | WebFiddle | How.nz | Helix AI Assistant