TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Glossary Navigation
A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | All


N
Namespace
In the PHP world, namespaces are deigned to solve two problems that authors of libraries, and applications encounter when creating re-usable code elements such as classes or functions:

1. Name collisions between the code you create.
2. Ability to alias Extra_Long_Names designed to alleviate the first problem, improving readability of source code.

PHP Namespaces provide a way in which to group related classes, functions and constants. Here is an example of namespace syntax in PHP:

PHP Code:
# Create our namespace.
namespace Main;

class 
App {
    public function 
test() {
        return 
__METHOD__;
    }
}

# Alias our namespace, and class to "MA" for readability
use MainApp as MA;

# Create new instance of our object "App"
$obj = new MA();

# The following line will output Main\App::test
echo $obj->test(); 
Nesting
Nesting is to put code inside of other code. Most commonly used in loops and if statements - for example, you could next an if() statement inside of another if() statement.

All times are GMT. The time now is 06:39 AM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design