Page 1 of 1

Regarding Namespace

Posted: Fri Sep 26, 2008 1:20 am
by iworktech_kiran
Hello,

I am new to PHP development and want to explore the features of PHP..

I have installed : php-5.2.6-win32-installer.msi setup along with
: apache_2.2.8-win32-x86-no_ssl.msi

In application when i add namespace as mention in following code

<?php
nampespace MyNamespace ;

class Test
{
public function hello()
{
echo 'Hello';
}
}
?>

it gives the following Error :


Parse error: syntax error, unexpected T_STRING in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\DemoApps\Namespaces.php on line 2...

please help me to sortout this problem..

Is like that my PHP version not supports namespaces or I need to add something more..


Thanks in advance..

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 1:26 am
by Stryks
I'm not too sure ... but maybe you need to spell namespace correctly.

Code: Select all

//nampespace MyNamespace;
namespace MyNamespace;
Any help there?

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 1:51 am
by iworktech_kiran
Stryks wrote:I'm not too sure ... but maybe you need to spell namespace correctly.

Code: Select all

//nampespace MyNamespace;
namespace MyNamespace;
Any help there?

No ... Actually while typing i miss speld .
but in a code it is correct i.e namepace ..but still not working..

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 1:51 am
by iworktech_kiran
iworktech_kiran wrote:
Stryks wrote:I'm not too sure ... but maybe you need to spell namespace correctly.

Code: Select all

//nampespace MyNamespace;
namespace MyNamespace;
Any help there?

No ... Actually while typing i miss speld .
but in a code it is correct i.e namespace ..but still not working..

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 1:56 am
by Christopher
I thought namespaces were only available in PHP 5.3.0.

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 2:04 am
by iworktech_kiran
arborint wrote:I thought namespaces were only available in PHP 5.3.0.

Ok ..

Thanks for your help..

Re: Regarding Namespace

Posted: Fri Sep 26, 2008 3:34 pm
by The_Anomaly
arborint wrote:I thought namespaces were only available in PHP 5.3.0.
Heck, last thing I read said that Namespaces werent' implemented in PHP at all. Was listed as evidence for PHP not being a "fully" OOP language.

That must have been written a while ago then.