faqts : Computers : Programming : Languages : PHP

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

0 of 1 people (0%) answered Yes
Recently 0 of 1 people (0%) answered Yes

Entry

In what way can I use "namespaces as in C++" in PHP?

Feb 25th, 2008 23:53
dman, taylor gerring, Jeroen Visser, http://www.ttnr.org


PHP supports object-oriented programming through the use of classes 
and ojects. You can find out everything you need to know in the php 
manual online at http://www.php.net/manual/en/ref.classobj.php
In general, the structure is as follows:
class mySpace
{
    myFunction()
    {
        return 1;
    }
}
$someSpace = new mySpace;
$theAnswer = $someSpace->myFunction();