TalkPHP

TalkPHP (http://www.talkphp.com/forums.php)
-   The Lounge (http://www.talkphp.com/lounge/)
-   -   PHP 5.3 is here!!! (http://www.talkphp.com/lounge/4652-php-5-3-here.html)

ETbyrne 06-30-2009 02:07 PM

PHP 5.3 is here!!!
 
Time to have a block party!!!
> http://php.net

And take a look at all those new date functions, it's about time!
> http://us2.php.net/manual/en/migration53.functions.php

Tanax 06-30-2009 03:00 PM

http://se.php.net/manual/en/functions.anonymous.php

Hurray! That is awesome ^_^

Wildhoney 06-30-2009 03:08 PM

That's my favourite addition to 5.3 :-) !

ETbyrne 06-30-2009 03:18 PM

Anonymous functions are epic.

PHP Code:

$message = function()
{
  echo 
'Hello, PHP 5.3!';
};

$message(); 


Village Idiot 06-30-2009 03:49 PM

I don't see the point in anonymous functions. Could someone enlighten me to how they are an improvement?

cecilia 06-30-2009 04:06 PM

I wonder when we'll get this version. I like the way the list looks, the MySQL, Array and Date primarily.

As for anonymous, will this run?

$x = 'message()';
${$x};

OR

$x = 'message';
${$x}();

Enfernikus 06-30-2009 04:36 PM

Quote:

Originally Posted by Village Idiot (Post 26391)
I don't see the point in anonymous functions. Could someone enlighten me to how they are an improvement?

Think array_map

Salathe 06-30-2009 04:44 PM

Quote:

Originally Posted by Village Idiot (Post 26391)
I don't see the point in anonymous functions. Could someone enlighten me to how they are an improvement?

I can't think of a situation where an anonymous function would be required which cannot be done any other way, so it'll certainly be possibly to continue life without ever using an anonymous PHP function.

However, I see the three following scripts and prefer the new anonymous function one. It's a silly example script but I think it gets the point across.

PHP Code:

$subject     'Hello, world!';
$pattern     '/\bworld\b/i';
$replacement 'Salathe';

/*
    Regular, boring function
*/
function mycallback($match)
{
    
// Do some complicated stuff
    
return $GLOBALS['replacement'];
}
echo 
preg_replace_callback($pattern'mycallback'$subject);

/*
    Anonymous function via create_function
*/
echo preg_replace_callback($patterncreate_function('$match''
    // Do some complicated stuff
    return $GLOBALS["replacement"];
'
), $subject);

/*
    Anonymous function
*/
$callback = function($match) use ($replacement)
{
    
// Do some complicated stuff
    
return $replacement;
};
echo 
preg_replace_callback($pattern$callback$subject); 


ETbyrne 06-30-2009 05:01 PM

If you ever used javascript to a large extent you would get the idea. Just think jQuery.

Code:

$('#element').click(function(){
  // Do something
});


xenon 06-30-2009 05:34 PM

this is also another nifty addition, I think :)

adamdecaf 07-01-2009 12:50 AM

Quote:

Originally Posted by knight13 (Post 26408)
I know this may be a stupid question but is this upgrade to php something that will halt my learning process or have they just added small features that i do not really have to worry about right now?

It's an update, they have added a bunch of new things and taken out a few things. It should not alter your learning curve if you are still on the opening section.

ETbyrne 07-01-2009 02:48 AM

The next version will probably be 5.4, but that's just a safe guess ;-)

Kalle 07-02-2009 03:12 PM

PHP 6.0 is planned to be released as next major updated, and after 6.0 its been suggested to develop a 5.4 release to ease the upgrade to PHP 6.0 in the end, whilst thats a good idea for the user, i dont see a reason to develop a 5.4 because hosts will rather upgrade to a 5.4 than a new major.

Enfernikus 07-02-2009 03:50 PM

Kalle, you wouldn't happen to know where to get a complete list of features, upgrades, and bug fixes to php6 would you? I can't find one.

Kalle 07-02-2009 05:21 PM

Quote:

Originally Posted by Enfernikus (Post 26488)
Kalle, you wouldn't happen to know where to get a complete list of features, upgrades, and bug fixes to php6 would you? I can't find one.

Sure, the current list of completed items are in the NEWS file in the cvs repo:
http://cvs.php.net/viewvc.cgi/php-src/NEWS?view=markup
(I actually had the joy of removing define_syslog_variables from PHP6 =))

For a list of features we plan to put into php6 as of our last PDM (PHP Developers Meeting) summit can be found here:
http://wiki.php.net/summits/pdmnotesmay09

Currently theres some ideas about putting type hinting into PHP6 aswell, but well who knows, nothing is final yet :)

ETbyrne 07-02-2009 10:56 PM

So what is the point of releasing 5.4 after 6.0??

Kalle 07-02-2009 11:03 PM

Absolutely non if you ask me

ETbyrne 07-03-2009 12:19 AM

I second that

Kalle 07-03-2009 01:04 AM

Theres no point in even releasing a 5.4 before, because we all know that it will just be a nail in php6's coffin

adamdecaf 07-03-2009 04:29 AM

People are taking advantage of "beta"'s and writing books on them saying that they are finished products. (They are correct of course in that the book is finished not the code, thats how they get away with it.)


All times are GMT. The time now is 11:23 AM.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0