note 53910 added to function.parse-ini-file
| From: | phpcoder at cyberpimp dot pimpdomain dot com | Date: | Thu, 16 Jun 2005 14:55:55 +0000 |
| Subject: | note 53910 added to function.parse-ini-file | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-90547@lists.php.net to get a copy of this message | ||
Oops. There is a small bug in my writeINIfile code example submitted on 13-Jan-2005 11:31. How
embarassing. The incorrect statement is:
if (substr($comtext, -1, 1)==$commentchar && substr($comtext, -1, 1)!=$commentchar) {
Note that this is a logic error and the statement will never execute. It should have been written
as:
if (substr($comtext, -1, 1)==$commentchar && substr($commenttext, -1, 1)!=$commentchar) {
Notice how in the corrected statement, the string passed to the second substr() function call is
$commenttext and not $comtext.
The purpose of this statement was to determine when to strip off the extra comment character that
inadvertently gets appended to the comment text block by the previous compounded str_replace code
(to prepend comment characters on each line of the comment text block) when the original comment
text ends with a new-line sequence.
----
Manual Page -- http://www.php.net/manual/en/function.parse-ini-file.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+53910
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+53910&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+53910&report=yes
Search -- http://master.php.net/manage/user-notes.php