Share on Google+Share on Google+
Sub Namespace
Posted on: April 1, 2010 at 12:00 AM
Advertisement
In this tutorial we will study about sub namespace in PHP, how to declare namespace in PHP, how to access etc. Examples will make this clearer.

Declaring sub-namespace:

We all are familiar with the directory structure or the tree of the file and folders, similarly we can get the nested or sub namespaces in PHP, this technique helps us to achieve more manageability. If you have done Java or C# before then this topic will be more easier.

The following example is illustrating the concept of this topic, no output will be generated.

Example:

<?php

namespace mySpace\FirstLevel\SecondLevel;

function myFunction()

{

echo __FUNCTION__;

}

class One

{

function myMethod()

{

echo __METHOD__;

}

}

 

?>

Advertisement

Related Tags for Sub Namespace:


Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: April 1, 2010

Recommend the tutorial

Advertisements Advertisements
 

 

 

DMCA.com