<?php
namespace Foo\Bar;
include 'file1.php';
const FOO = 2;
function foo() {}
class foo
{
static function staticmethod() {}
}
/* Unqualified name */
foo(); // resolves to function Foo\Bar\foo
foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod
echo FOO; // resolves to constant Foo\Bar\FOO
/* Qualified name */
subnamespace\foo(); // resolves to function Foo\Bar\subnamespace\foo
subnamespace\foo::staticmethod(); // resolves to class Foo\Bar\subnamespace\foo,
// method staticmethod
echo subnamespace\FOO; // resolves to constant Foo\Bar\subnamespace\FOO
/* Fully qualified name */
\Foo\Bar\foo(); // resolves to function Foo\Bar\foo
\Foo\Bar\foo::staticmethod(); // resolves to class Foo\Bar\foo, method staticmethod
echo \Foo\Bar\FOO; // resolves to constant Foo\Bar\FOO
?>
Warning: include(): open_basedir restriction in effect. File(file1.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/QY6L9 on line 3
Warning: include(file1.php): Failed to open stream: Operation not permitted in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Uncaught Error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9:18
Stack trace:
#0 {main}
thrown in /in/QY6L9 on line 18
Process exited with code 255.
Output for 8.0.13
Warning: include(file1.php): Failed to open stream: No such file or directory in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Uncaught Error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9:18
Stack trace:
#0 {main}
thrown in /in/QY6L9 on line 18
Process exited with code 255.
Output for 7.3.32 - 7.3.33, 7.4.33
Warning: include(file1.php): failed to open stream: No such file or directory in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Uncaught Error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9:18
Stack trace:
#0 {main}
thrown in /in/QY6L9 on line 18
Process exited with code 255.
Warning: include(): open_basedir restriction in effect. File(file1.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/QY6L9 on line 3
Warning: include(file1.php): failed to open stream: Operation not permitted in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Uncaught Error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9:18
Stack trace:
#0 {main}
thrown in /in/QY6L9 on line 18
Process exited with code 255.
Output for 5.5.0 - 5.5.38, 5.6.0 - 5.6.40
Warning: include(): open_basedir restriction in effect. File(file1.php) is not within the allowed path(s): (/tmp:/in:/etc) in /in/QY6L9 on line 3
Warning: include(file1.php): failed to open stream: Operation not permitted in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9 on line 18
Process exited with code 255.
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45
Warning: include(file1.php): failed to open stream: No such file or directory in /in/QY6L9 on line 3
Warning: include(): Failed opening 'file1.php' for inclusion (include_path='.:') in /in/QY6L9 on line 3
2
Fatal error: Call to undefined function Foo\Bar\subnamespace\foo() in /in/QY6L9 on line 18
Process exited with code 255.