CKTIS / PHP
current()
Prebere trenutno vrednost brez premika kazalca.
Različica: PHP 8.4; repository runtime, production runtime not attested
Sintaksa
current(array|object $array): mixedPrebere trenutno vrednost brez premika kazalca. Pri false ključ, različen od null, tudi 0 ali "", označuje obstoječi element. Podajanje objektov je od PHP 8.1 zastarelo.
Podpis
current(array|object $array): mixed
Izhod primera
[["off",false,"off"],[null,false]]
Primeri
<?php
$flags = ["off"=>false,"on"=>true];
$first = [key($flags),current($flags),key($flags)];
next($flags); next($flags);
echo json_encode([$first,[key($flags),current($flags)]]);
Rezultat
[["off",false,"off"],[null,false]]