Regarding Namespace

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
iworktech_kiran
Forum Newbie
Posts: 4
Joined: Fri Sep 26, 2008 1:11 am

Regarding Namespace

Post 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..
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Re: Regarding Namespace

Post 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?
iworktech_kiran
Forum Newbie
Posts: 4
Joined: Fri Sep 26, 2008 1:11 am

Re: Regarding Namespace

Post 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..
iworktech_kiran
Forum Newbie
Posts: 4
Joined: Fri Sep 26, 2008 1:11 am

Re: Regarding Namespace

Post 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..
User avatar
Christopher
Site Administrator
Posts: 13596
Joined: Wed Aug 25, 2004 7:54 pm
Location: New York, NY, US

Re: Regarding Namespace

Post by Christopher »

I thought namespaces were only available in PHP 5.3.0.
(#10850)
iworktech_kiran
Forum Newbie
Posts: 4
Joined: Fri Sep 26, 2008 1:11 am

Re: Regarding Namespace

Post by iworktech_kiran »

arborint wrote:I thought namespaces were only available in PHP 5.3.0.

Ok ..

Thanks for your help..
User avatar
The_Anomaly
Forum Contributor
Posts: 196
Joined: Fri Aug 08, 2008 4:56 pm
Location: Tirana, Albania

Re: Regarding Namespace

Post 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.
Post Reply