- current: documentation ( source)
<?php
$list = array("A","B","C","D");
foreach ( $list as $var ) {
print(current($list));
}
echo "\n";
foreach ( $list as $var ) {
print(item($list));
}
function item($list) {
return current($list);
}
echo "\n";
item2($list);
function item2($list) {
foreach ( $list as $var ) {
print(current($list));
}
}
?>