|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2012-10-09 10:39 UTC] simon dot champion at connectionservices dot com
Description: ------------ --- From manual page: http://www.php.net/splfileobject.construct#refsect1-splfileobject.construct-examples --- Example #1 SplFileObject::__construct() example In this example, the "expected output" box is currently showing the code, not the output (ie it is identical to the box above it containing the code). PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 08 19:00:01 2026 UTC |
Sorry: my point was not that the example is incorrect, but that it's unclear. Sorry if I didn't express that well. I believe it could be improved by adding something (for example line numbers) to the output. This would make it clearer that it is the result of the code being run rather than simply a copy of the original source code. This is what I would suggest: <?php $file = new SplFileObject(__FILE__); foreach ($file as $lineNum=>$line) { echo "Line # " . $lineNum . ": " . $line; } ?>