note 124166 added to function.fgets

From: Date: Tue, 03 Sep 2019 11:29:41 +0000
Subject: note 124166 added to function.fgets
Groups: php.notes 
Request: Send a blank email to php-notes+get-212093@lists.php.net to get a copy of this message
It's strange no one mentions "0" in this context. Since "0" is considered to be false, a line with a single "0" can be treated as EOF if using the while assign idiom. while ($line = fgets(STDIN, 2)) { } This may surprisingly break if a line starts with ")" ---- Server IP: 208.43.231.9 Probable Submitter: 185.85.3.195 (proxied: 183.128.160.225) ---- Manual Page -- http://php.net/manual/en/function.fgets.php Edit -- https://master.php.net/note/edit/124166 Del: integrated -- https://master.php.net/note/delete/124166/integrated Del: useless -- https://master.php.net/note/delete/124166/useless Del: bad code -- https://master.php.net/note/delete/124166/bad+code Del: spam -- https://master.php.net/note/delete/124166/spam Del: non-english -- https://master.php.net/note/delete/124166/non-english Del: in docs -- https://master.php.net/note/delete/124166/in+docs Del: other reasons-- https://master.php.net/note/delete/124166 Reject -- https://master.php.net/note/reject/124166 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#212093) next »