Re: Namespace problem?

From: Date: Wed, 16 Jul 2008 15:30:38 +0000
Subject: Re: Namespace problem?
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-39009@lists.php.net to get a copy of this message
The "use" can be used only as top-level statement. Thanks. Dmitry. Stefan Priebsch wrote:
Hi list, I was playing around with namespaces and stumbled across this: #!/home/steve/php5.3-200807070430/sapi/cli/php <?php namespace Foo; use Foo::Bar as Something; class Bar { } ?> works fine, whereas #!/home/steve/php5.3-200807070430/sapi/cli/php <?php namespace Foo; {
    use Foo::Bar as Something;
    class Bar { }
} ?> yields: Parse error: syntax error, unexpected T_USE in /home/steve/namespaces/code/with_braces.php on line 6 Regards, Stefan


« previous php.internals (#39009) next »