Aaron Rosenfeld / 14 posts / 9 comments / feed / comments feed

PHP v5.3 Alpha 1

I usually don’t update my blog for PHP versions but the announcement made at the beginning of the month really caught my eye.

declare(Ticks=N) Depreciated
First off, they finally depreciated the declare(Ticks…) construct. I never really found a use for this and actually had it crash a web server due to threading issues. Thankfully, PHP is no longer formally supporting this function along with register_tick_function.

Ternary Default
In the last few months I have found myself using the ternary operator extensively to save space. Most of the time it ends up being in the form:

$var .= $other_var ? 'some string' : '';

Thankfully this can now be shortened to simply:

$var .= $other_var ? 'some string' :;

to omit the false case, and to:

$var .= $other_var ?: 'some other string';

to omit the true case.

Namespace
For some reason namespace isn’t currently a reserved word. In v5.3 Alpha 1, it is.

goto Keyword
This one I don’t like. PHP decided to add the dreaded goto/label: construct. I have absolutely no clue why they would do this since it is never needed in modern programming.

Nothing is groundbreaking but most of the changes are a breath of fresh air. My only concern is goto which I hope does not make it to the release branch…

1 Comment

  1. Dan Osipov — August 28, 2008 #

    There is more to ‘namespaces’ than just reserved keyword - in fact I think that’s the most important feature in 5.3. namespacing classes allow same name classes from various libraries not to clash. You could then ‘use’ the correct class in each case. This finally depreciates the unneeded prefixes to functions which are commonly used to prevent conflicts.

Leave a comment