What’s new in PHP 5.1?

By | | PHP

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/.

{ 21 comments }

c4tsitvizelv September 18, 2008 at 7:18 pm

boccar

MickoZ August 17, 2006 at 6:05 am
Etnu July 4, 2005 at 2:13 pm

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)
{
require_once(CLASS_DIR.$Class.’.php’;
}

include the file using php’s auto_prepend ini settting,

and:

< ?php
NameSpace::DoSomeFunction();
?>

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:

NameSpace:::Function();
NameSpace:::ClassName();

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.

sweatje June 29, 2005 at 5:23 pm

[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]

selfmindead June 28, 2005 at 7:10 pm

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

RicoD June 22, 2005 at 6:53 am

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!

Eric.Coleman June 17, 2005 at 6:03 am

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.

Gabriel Ricard June 16, 2005 at 5:23 pm

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:

MyCoolProject_doThis()
MyCoolProject_doThat()

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.

pachanga June 16, 2005 at 3:46 am

“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!

BDKR June 15, 2005 at 11:05 am

So what’s different with the swtich statement?

Dysfunksional.Monkey June 15, 2005 at 9:42 am

“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.

andre June 15, 2005 at 6:00 am

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

sanka69 June 15, 2005 at 5:27 am
bmn June 15, 2005 at 2:08 am

What is PDO?

Eric.Coleman June 14, 2005 at 6:51 pm

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.

Dr Livingston June 14, 2005 at 10:53 am

> 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.

lsmith June 14, 2005 at 5:55 am

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

trickie June 14, 2005 at 3:57 am

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.

Olate June 14, 2005 at 3:14 am

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

momos June 14, 2005 at 3:04 am

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 :)

Andrew-J2000 June 14, 2005 at 2:49 am

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

Comments on this entry are closed.