Read the latest web development and design tips at Fred Wu's new blog! :-)
Poke me on GitHub

PHP Namespace – $this->sux

Federico makes an interesting point about the PHP Namespaces Controversy on his PHP::Impact blog. I never thought about the mess that is PHP until I saw his comparison table:

Attribute/Method access:
Static method access:
Package access:

Attribute/Method access:
Static method access:
Namespace access:

Attribute/Method access:
Static method access:
Module access: 

Attribute/Method access: $foo->bar
Static method access:    Foo::bar
Namespace access:        C:\foo\bar\baz

I guess I can’t complain though as the syntax of PHP is still a lot closer to more “traditional” languages than something like Ruby (not talking about the namespace, just the language in general)… :)

  • Digg
  • DZone
  • Facebook
  • Mixx
  • Google Bookmarks
  • LinkedIn
  • Live
  • Reddit
  • Slashdot
  • StumbleUpon
  • Technorati
  • Twitter

Related posts

Tags: , ,

Comments Section

One Response to “PHP Namespace – $this->sux”

Sidebar might be covered by comments ... consider it a feature! ;)
  1. 1

    PHP’s access things are taken from C/C++.
    C/C++ have . -> and :: for different things.

    Having the :: makes it easier to see static methods, as you and stick a non-initialiuzed class into a variable if you want (although usually that would be silly)

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>