 |
Account Login
|
 |
 |
Latest Articles
|
 |
 |
IRC Channel
|
 |
 |
Associates
|
 |
 |
Associates
|
 |
|
 |
|
 |
|
 |
06-30-2009, 03:00 PM
|
#2 (permalink)
|
|
The Prestige
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,053
Thanks: 115
|
__________________
|
|
|
|
06-30-2009, 03:08 PM
|
#3 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,215
Thanks: 90
|
That's my favourite addition to 5.3  !
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|
06-30-2009, 03:18 PM
|
#4 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
Anonymous functions are epic.
PHP Code:
$message = function() { echo 'Hello, PHP 5.3!'; };
$message();
|
|
|
|
06-30-2009, 03:49 PM
|
#5 (permalink)
|
|
Wizard
Join Date: Sep 2007
Posts: 1,216
Thanks: 17
|
I don't see the point in anonymous functions. Could someone enlighten me to how they are an improvement?
|
|
|
|
06-30-2009, 04:06 PM
|
#6 (permalink)
|
|
The Contributor
Join Date: May 2009
Location: LA, CA
Posts: 93
Thanks: 0
|
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}();
|
|
|
|
06-30-2009, 04:36 PM
|
#7 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 322
Thanks: 2
|
Quote:
Originally Posted by Village Idiot
I don't see the point in anonymous functions. Could someone enlighten me to how they are an improvement?
|
Think array_map
|
|
|
|
06-30-2009, 04:44 PM
|
#8 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,239
Thanks: 3
|
Quote:
Originally Posted by Village Idiot
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($pattern, create_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);
__________________
salathe@php.net
|
|
|
|
06-30-2009, 05:01 PM
|
#9 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
If you ever used javascript to a large extent you would get the idea. Just think jQuery.
Code:
$('#element').click(function(){
// Do something
});
|
|
|
|
06-30-2009, 05:34 PM
|
#10 (permalink)
|
|
The Frequenter
Join Date: Dec 2007
Location: Bucharest, Romania
Posts: 440
Thanks: 3
|
this is also another nifty addition, I think :)
__________________
I have optimistic thoughts, even though sometimes (if not always) life's a bitch.
|
|
|
|
07-01-2009, 12:42 AM
|
#11 (permalink)
|
|
The Frequenter
Join Date: Jun 2009
Location: Cleveland,Ohio
Posts: 430
Thanks: 30
|
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?
__________________
Anyone who has never made a mistake has never tried anything new.
~ Albert Einstein ~
|
|
|
|
07-01-2009, 12:50 AM
|
#12 (permalink)
|
|
The Addict
Join Date: May 2009
Posts: 309
Thanks: 5
|
Quote:
Originally Posted by knight13
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.
|
|
|
|
07-01-2009, 02:01 AM
|
#13 (permalink)
|
|
The Frequenter
Join Date: Jun 2009
Location: Cleveland,Ohio
Posts: 430
Thanks: 30
|
Thanks adamdecaf ~~ I was just making sure.
Will the next php version be 6.0?
__________________
Anyone who has never made a mistake has never tried anything new.
~ Albert Einstein ~
|
|
|
|
07-01-2009, 02:48 AM
|
#14 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
The next version will probably be 5. 4, but that's just a safe guess 
|
|
|
|
07-02-2009, 03:12 PM
|
#15 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
|
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.
__________________
|
|
|
07-02-2009, 03:50 PM
|
#16 (permalink)
|
|
The Addict
Join Date: Jun 2008
Posts: 322
Thanks: 2
|
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.
|
|
|
|
07-02-2009, 05:21 PM
|
#17 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
|
Quote:
Originally Posted by Enfernikus
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 :)
__________________
|
|
|
07-02-2009, 10:56 PM
|
#18 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
So what is the point of releasing 5.4 after 6.0??
|
|
|
|
07-02-2009, 11:03 PM
|
#19 (permalink)
|
|
The Frequenter
Join Date: Sep 2007
Location: Denmark
Posts: 353
Thanks: 8
|
Absolutely non if you ask me
__________________
|
|
|
07-03-2009, 12:19 AM
|
#20 (permalink)
|
|
how quixotic are you?
Join Date: Dec 2007
Location: Lapeer, MI
Posts: 445
Thanks: 37
|
I second that
|
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|