php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #13802 Typo in require() statement description ?
Submitted: 2001-10-23 14:21 UTC Modified: 2001-10-24 00:22 UTC
From: robert dot w at 12move dot nl Assigned:
Status: Not a bug Package: Documentation problem
PHP Version: 4.0.6 OS:
Private report: No CVE-ID: None
 [2001-10-23 14:21 UTC] robert dot w at 12move dot nl
Quoting the fifth paragraph of the English language version:

"Unlike include(), require() will always read in the target file, even if the line it's on never executes. If you want to conditionally include a file, use include(). The conditional statement won't affect the require(). However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed."

I think the last line is contradicting the first line :
FIRST LINE : "...require() will always read in the target file, even if the line it's on never executes."
LAST LINE : "However, if the line on which the require() occurs is not executed, neither will any of the code in the target file be executed."

This the same in the Dutch language version.

IMHO the last line should read : 
"However, if the line on which the include() occurs is not executed, neither will any of the code in the target file be executed."

Robert Waarde

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-10-23 14:35 UTC] sander@php.net
It is correct the way it is.
 [2001-10-23 14:53 UTC] goba@php.net
To Robert: It means that the file is included there,
but the code from the file is not executed, because some
condition (eg. an if statement).

if ($foo) {
    require "foo.php";
}

This code (as the manual says) will __always__ 
load in foo.php and will replace the require
statement with the contents of that file, but
this content is only executed if $foo is true.

Goba
 [2001-10-24 00:22 UTC] robert dot w at 12move dot nl
I got it.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 18:01:29 2024 UTC