KBD

Keith Devens .com

Friday, May 16, 2008 Flag waving
And this too, shall pass. – often attributed to Abraham Lincoln
← CrystalTesting changes to my Blogger API →

Daily link icon Sunday, June 9, 2002

Zend 2.0 - Watch out!

Via PHPEverywhere, an initial release of the Zend Engine 2.0. For those who don't know, Zend is the engine which is the basis for PHP.

New stuff:

  • New Object Model
  • Private Members
  • Object Cloning
  • Forced deletion of objects
  • Nested classes (namespaces)
  • Classes may contain classes
  • Classes may contain constants
  • Current namespace's symbol tables are searched first for constants and functions
  • In the scope of a function, the current namespace is that of the containing class/namespace
  • It is possible to "import" symbols from one namespace into another
  • Unified Constructors
  • Destructors
  • Exceptions
  • Dereferencing objects returned from functions
  • Static member variables of static classes can now be initialized
  • Parameters that are passed by reference to a function may now have default values
  • Built-In Backtracing

I just copied the major bullet points from the changes file. I gotta read everything in detail and understand what exactly has changed. They have examples of some of the new code you can use. One of the nice things is that you can dereference an object returned from a function, as in this snippet, which you just couldn't do before:

<?php
 ShapeFactoryMethod
("Circle")->draw();
 
ShapeFactoryMethod("Square")->draw();

 
#and you can even do it multiple times
 
print $person->getName()->display();
?>

Other nice things, exceptions, namespaces (a class can act as a namespace (its own scope), so you have more flexibility with scoping than we did before. You can refer to variables in your namespace by typing self::$variable_name, and import names from one namespace to another. That's great! - much better way to package reusable code), you can do stuff like this:

<?php
 
#reference argument has a default value! 
 
function my_function(&$var null) {
?>

All good news. As you can see, most of the changes have to do with their object model, which was pretty much broken in all previous versions of PHP. I almost never used classes - now maybe I will, and exceptions, and namespaces, and on and on. PHP's almost all growed up <sniff>.

← CrystalTesting changes to my Blogger API →

Comments XML gif


Feel free to post a comment below. Please see my comment policy.

Formatting Rules (No HTML):

  • **bold**, *italic*, _underlined_, --strikeout--
  • "text"="url" creates a link, and URLs are auto-highlighted
  • Blockquote: Like e-mail, begin paragraph with > (greater-than sign)
  • Lists: begin paragraph with *,-, or + (unordered), or # (ordered)
  • Code block: ?!code:language=perl|php|sql|javascript|etc.{\n}...{\n}?!/code

:
(will be your IP address if blank)
: (optional)
(Will not be shown on site)

: (optional)
:

May 2008
SunMonTueWedThuFriSat
 123
45678910
11121314151617
18192021222324
25262728293031



RSS feed RSS feed for Keith's Weblog
Atom feed Atom feed for Keith's Weblog
Weblog archive
Recent comments
  on 1 posts

Recent comments XML

"IMDB for music"

IMDB for Music? It looks to be a​couple of years old...​http://MusicTell.co...

Ken Empie: May 14, 9:57pm

Generated in about 0.219s.

(Used 8 db queries)