What’s new in PHP 5.1?


PHP.net announced over the weekend that the first public beta of PHP 5.1 (5.1.0) is now available for download on PHP.net.

So what’s changed?

PHP 5.1 can be downloaded from PHP website.

As of now there is an entry PHP.net’s RSS feed about the release but no word about it on the front page of http://www.php.net/.

Free JavaScript: Novice to Ninja Sample

Get a free 32-page chapter of JavaScript: Novice to Ninja and receive updates on exclusive offers from SitePoint.

  • http://www.ajohnstone.com Andrew-J2000

    I read this and thought there was already another release. It’s PHP 5.1.0b1…

  • momos

    I was about to finish my own OO data-abstraction, and now it’s native in 5.1 :(
    On the other hand, data-abstraction is native in 5.1 :)

  • http://www.olate.co.uk Olate

    See about a problem with PHP 5.1 – if you get the snapshot though it should be fine: http://www.netevil.org/node.php?uuid=42aafccd-2812-2642-6775-2aafccd47217

  • http://www.trickie.org trickie

    The other big inclusion is PDO built in. I am not sure whether the PDO drivers get built automatically when you build any of the old db libraries, but it is there by default.

  • lsmith

    Yes if you enable pgsql it will build with the native ext and the pdo driver.

  • Dr Livingston

    > The other big inclusion is PDO built in.

    Now that is good news. I have PDO on my laptop but not the desktop as I can’t be bothered to transfer the DLLs over :lol:

    But I can’t see myself downloading and upgrading at the moment, not got the time nor the inclination to do so, so PHP5.0.3 stays with me.

  • http://aplosmedia.com/ Eric.Coleman

    Ok, let’s all just boycot php & zend until they give us namespaces….

    5.5 (or whatever they are going to call it, since it’s up in the air) is supposed to have native utf8 support. This is great, and a step forward, but yet, we are still going to be waiting YEARS for namespace support.

  • bmn

    What is PDO?

  • sanka69
  • andre

    php is not java. and it’s not intended for the things java was. why make such a big deal out of namespaces?

  • Dysfunksional.Monkey

    “why make such a big deal out of namespaces?”

    Because many of us use PHP for much more than simple scripts. And if you try to use something like Propel alongside a PHP MVC Framework, things can get very messy.

    Plus, namespaces are just useful in general.

  • http://mgaps.highsidecafe.com BDKR

    So what’s different with the swtich statement?

  • http://limb-project.com pachanga

    “Ok, let’s all just boycot php & zend until they give us namespaces….”

    What about creating a PHP namespace petition somewhere? :) I think lots
    of serious PHP developers would gladly sign it…

    “Because many of us use PHP for much more than simple scripts. And if you try to use something like Propel alongside a PHP MVC Framework, things can get very messy.”

    Very true!

  • Gabriel Ricard

    Annoying: click in “Your name” box to type my name in, got a stupid pop-up instead. :|

    Namespaces, eh? How about just using static class methods to namespace your functions? Seriously, aside from having to place all the code in one file, what is the difference between namespaces and the following:

    class MyCoolProject {

    function doThis() { }

    function doThat() { }


    Or just prefix your functions/classes with a proper name:


    No, you can’t just import namespaces and use shorthand versions, but then you’d still run into name collisions there if you did.

    In other words: meh.

  • http://aplosmedia.com/ Eric.Coleman

    well, technically you could do something like this

    < ?php
    class namespace {
    static public function obj( $obj_name ) {
    return new $obj_name;

    namespace::obj( 'some_object' )->blah();

    but it’s still just an ugly hack.

  • RicoD

    I think this native Database Abstraction is a great step to get away from the usual thought that php and mysql are similiar… and furthermore I hope more Providers (especially the german ones :( ) will now be forced to move to php 5!

  • http://www.dreek.com selfmindead

    If hosts would just start switching to PHP5 already (if it got out of beta they would do it btw.. you can’t expect professional hosting services to switch before it is fully released) i would force myself to get familiar with the changes!

    I really do like this new idea about native DB abstraction

  • http://blog.casey-sweat.us/ sweatje

    [quote="selfmindead"](if it got out of beta they would do it btw.. you can’t expect professional hosting services to switch before it is fully released)[/quote]

    Eh??? PHP 5 has been release for almost a year now.

    from http://www.php.net/news-2004.php
    [quote="PHP news"]PHP 5.0.0 Released!

    [13-Jul-2004] The PHP team is proud to announce the final release of PHP 5!

    Some of the key features of PHP 5 include:

    * The Zend Engine II with a new object model and dozens of new features.
    * XML support has been completely redone in PHP 5, all extensions are now focused around the excellent libxml2 library (http://www.xmlsoft.org/).
    * A new SimpleXML extension for easily accessing and manipulating XML as PHP objects. It can also interface with the DOM extension and vice-versa.
    * A brand new built-in SOAP extension for interoperability with Web Services.
    * A new MySQL extension named MySQLi for developers using MySQL 4.1 and later. This new extension includes an object-oriented interface in addition to a traditional interface; as well as support for many of MySQL’s new features, such as prepared statements.
    * SQLite has been bundled with PHP. For more information on SQLite, please visit their website.
    * Streams have been greatly improved, including the ability to access low-level socket operations on streams.
    * And lots more…

    For changes since Release Candidate 3, please consult the ChangeLog. [/php]

  • Etnu

    PHP5 is great, but I agree fully with the namespace arguement.

    Yes, it’s possible to simply wrap all your functions up as static class members, but that only works so far. Trying to do it with a class is a pain in the butt.

    You can do something like this for functions

    function __autoload($Class)

    include the file using php’s auto_prepend ini settting,


    < ?php

    Will be perfectly valid.

    My current solution to the class name issue is a simple one, of course — I just make sure to name my classes something unique and descriptive.

    I think the best solution, without any performance overhead, would be a mechanism like a triple-colon:


    Not as clean as C++ namespaces (due to the extra colon), but it would create a unique operator that wouldn’t have to change the current logic of the compiler.

  • MickoZ

    There is a petition online FYI:

  • c4tsitvizelv