Merge branch 'gh-pages' of github.com:codeguy/php-the-right-way into gh-pages

This commit is contained in:
=
2012-07-09 13:00:22 -04:00
2 changed files with 13 additions and 12 deletions

View File

@@ -1,18 +1,8 @@
# Language Highlights
## Namespaces
As mentioned above, the PHP community has a lot of developers creating lots of code. This means that one library's PHP code may use the same class name as another library. When both libraries are used in the same namespace, they collide and cause trouble.
_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared to operating system directories that _namespace_ files; two files with the same name may co-exist in separate directories. Likewise, two PHP classes with the same name may co-exist in separate PHP namespaces. It's as simple as that.
It is important for you to namespace your code so that it may be used by other developers without fear of colliding with other libraries.
* [Read about Namespaces][namespaces]
## Programming Paradigms
PHP is a flexible, dynamic language that supports a variety of techniques. It has evolved dramatically over the years, notably adding a solid object-oriented model in PHP 5.0 (2004), anonymous functions and namespaces in PHP 5.3 (2009), and traits (or mixins) in PHP 5.4 (2012).
PHP is a flexible, dynamic language that supports a variety of programming techniques. It has evolved dramatically over the years, notably adding a solid object-oriented model in PHP 5.0 (2004), anonymous functions and namespaces in PHP 5.3 (2009), and traits (or mixins) in PHP 5.4 (2012).
### Object-oriented Programming
@@ -29,6 +19,17 @@ PHP is a flexible, dynamic language that supports a variety of techniques. It ha
* [Read about Magic Methods][magic-methods]
* [Read about Reflection][reflection]
## Namespaces
As mentioned above, the PHP community has a lot of developers creating lots of code. This means that one library's PHP code may use the same class name as another library. When both libraries are used in the same namespace, they collide and cause trouble.
_Namespaces_ solve this problem. As described in the PHP reference manual, namespaces may be compared to operating system directories that _namespace_ files; two files with the same name may co-exist in separate directories. Likewise, two PHP classes with the same name may co-exist in separate PHP namespaces. It's as simple as that.
It is important for you to namespace your code so that it may be used by other developers without fear of colliding with other libraries.
* [Read about Namespaces][namespaces]
## Standard PHP Library
The Standard PHP Library (SPL) is packaged with PHP and provides a collection of classes and interfaces. It is made up primarily of commonly needed datastructure classes (stack, queue, heap, and so on), and iterators which can traverse over these datastructures or your own classes which implement SPL interfaces.

View File

@@ -32,8 +32,8 @@
<li><a href="/index.html#code_style_guide">Code Style Guide</a></li>
<li><a href="/index.html#language_highlights">Language Highlights</a>
<ul>
<li><a href="/index.html#namespaces">Namespaces</a></li>
<li><a href="/index.html#programming_paradigms">Programming Paradigms</a></li>
<li><a href="/index.html#namespaces">Namespaces</a></li>
<li><a href="/index.html#standard_php_library">Standard PHP Library</a></li>
<li><a href="/index.html#command_line_interface">Command Line Interface</a></li>
</ul>