Search code examples
phpnamespaces

Namespace interface


I have struct:

/VBAL/
/VBAL/Interface/
/VBAL/Interface/Named.php
....
/VBAL/Component.php

Component.php:

namespace JV\VBAL; 
class Component implements \JV\VBAL\Interface\Named {}

Named.php:

namespace JV\VBAL\Interface;
interface Named {}

But I've got parse error:

Parse error: syntax error, unexpected '{', expecting T_STRING or T_NAMESPACE or T_NS_SEPARATOR

How do you call the directory "namespace", or place the files?


Solution

  • Interface is a reserved word in PHP. You can't use it as part of your namespace.