I would like to clarify what this RFC actually says. Let's try to keep
this thread to the pros and cons of this specific proposal.

The following new keyword would be introduced:

require_path

This keyword has two parameters of which the second is optional. The
first parameter is the path (filename or URL) to be required, and
behaves exactly as the sole parameter of the require keyword behaves.
The second parameter is an associative array.

If this second parameter is absent, require_path behaves exactly like require.

If the second parameter is present, the following keys may optionally
be present in the array, with the following effects:

If 'once' is present and true, the specified path is loaded no more
than once, exactly like require_once.

If 'warn' is present and true, a loading or compilation error results
in E_WARNING (per the current behavior of the include keyword). If
warn is absent or false, a loading or compilation error results in
E_COMPILE_ERROR (per the current behavior of the require keyword).

If 'code' is present and true, the parser begins reading the file as
if a <?php open tag had already been encountered. If code is absent or
false, the parser reads the file beginning in “HTML mode,” exactly as
the require keyword does today.

Examples:

// Behaves just like require
require_path 'filename.php';

// Behaves just like include_once
require_path 'filename.php', array('warn' => true, 'once' => true);

// Loads a file starting out in "PHP mode" so the opening <?php is not required
require_path 'filename.php', array('code' => true);

In addition, a convention (not a requirement checked by the code)
would be encouraged: PHP source code files without an initial <?php
would be named with a .phpc file extension.

That's all the RFC calls for. The rest of it is just responses to
frequently raised concerns:

https://wiki.php.net/rfc/source_files_without_opening_tag

-- 
Tom Boutell
P'unk Avenue
215 755 1330
punkave.com
window.punkave.com

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to