1--TEST-- 2SplFileObject::fread function 3--FILE-- 4<?php 5$obj = new SplFileObject(__FILE__, 'r'); 6$data = $obj->fread(5); 7var_dump($data); 8 9$data = $obj->fread(); 10var_dump($data); 11 12$data = $obj->fread(0); 13var_dump($data); 14 15// read more data than is available 16$data = $obj->fread(filesize(__FILE__) + 32); 17var_dump(strlen($data) === filesize(__FILE__) - 5); 18 19?> 20--EXPECTF-- 21string(5) "<?php" 22 23Warning: SplFileObject::fread() expects exactly 1 parameter, 0 given in %s on line %d 24NULL 25 26Warning: SplFileObject::fread(): Length parameter must be greater than 0 in %s on line %d 27bool(false) 28bool(true) 29