ID: 38247 Updated by: [EMAIL PROTECTED] Reported By: kahennig at gmail dot com -Status: Closed +Status: Bogus Bug Type: Documentation problem Operating System: Irrelevant PHP Version: Irrelevant
Previous Comments: ------------------------------------------------------------------------ [2006-07-29 19:30:32] kahennig at gmail dot com thanks for your answer. That clears it up for me. I have used these statements very often and then ran across the pear recommendation (since I am now trying to follow a coding standard) and that threw me off. I only realized yesterday that you could use these statements without parentheses and that's why I was wondering about what I percieved as an inconsistency... seems like it wasn't one after all. ------------------------------------------------------------------------ [2006-07-29 16:17:28] [EMAIL PROTECTED] There are lots of language constructs that parse like functions (optionally have parentheses). include, require, die, echo are all good examples. There's no necessarily "correct" way to do it, the parser takes care of them and it makes no difference to the end user. PHP's nature is to avoid strictness. As for your request to note this in the documentation, this is already stated on the include page (to which the require page refers). S ------------------------------------------------------------------------ [2006-07-28 21:13:50] kahennig at gmail dot com Description: ------------ In the Code Samples found in the documentation, pages for "include", "require", "include_once" and "require_once" these statements are sometimes used with parentheses e.g: include_once("a.php"); and sometimes without them e.g: require 'prepend.php'; It seems to me that if both are valid, this should be noted in the doc for each of these statements. Else, if the PEAR Coding Standards are right (see http://pear.php.net/manual/en/standards.including.php) and parentheses should not be used, then it might make sense to fix the examples and add a Note informing of the "correct" way to use these statements. I am well aware, that both ways work, but what is the "right" or "prefered" way? Is one deprecated in favor of the other? It might also be a good idea to include the answeres to these questions in the doc. Also, in the doc these statements are refered to as "include()", "require()", etc. Where they always have the parentheses after them. This seems quite confusing, if they really are not Functions but Statemens (as the Doc. says: "The include() STATEMENT includes and evaluates the specified file." -emphasis mine) It might also be worth eliminating the parentheses in the statement name from the Documentation. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=38247&edit=1