CKTIS / PHP
next()
Advance the internal array pointer before reading the next value.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
next(array|object &$array): mixedAdvance the internal array pointer before reading the next value. Calling next as the first read therefore skips the first element. A stored false and the end of the array both yield false; key distinguishes them. Passing objects is deprecated since PHP 8.1.
Signature
next(array|object &$array): mixed
Example output
[[false,"b"],[false,null]]
Examples
<?php
$items = ["a"=>7,"b"=>false];
echo json_encode([[next($items),key($items)],[next($items),key($items)]]);
Result
[[false,"b"],[false,null]]