Hi,
With the impending release of PHP 5.3 and the addition of namespaces
into PHP, there becomes the issue of integrating libraries that are
designed to still support PHP 4 (please, don't turn this into a
discussion about whether they should or not: this _is_ a real issue)
into something designed to use namespaces throughout. A simple
solution would be to just include/require a file _into_ a namespace,
which makes the default namespace in that file that namespace.
e.g. (inc. the case of defining a namespace in the included into a
namespace file),
a.php:
<?php
require 'b.php' into Foo;
Foo::hi();
echo "\n";
Bar::magic();
?>
b.php:
<?php
function hi() {
echo 'Hello, world!';
}
namespace Bar;
function magic() {
echo 'Wow! This is in a namespace both here and there!';
}
?>
Expected output:
Hello, world!
Wow! This is in a namespace both here and there!
--
Geoffrey Sneddon
<http://gsnedders.com/>
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php