(PHP 5 >= 5.1.0, PHP 7)
SplFileObject::valid — Not at EOF
public SplFileObject::valid ( ) : bool
Check whether EOF has been reached.
This function has no parameters.
Returns true
if not reached EOF, false
otherwise.
Example #1 SplFileObject::valid() example
<?php // Loop over a file, line by line $file = new SplFileObject("file.txt"); while ($file->valid()) { echo $file->fgets(); } ?>
© 1997–2020 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/splfileobject.valid.php