Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Timothy Boronczyk's Blog:
Currying in PHP
Jul 10, 2009 @ 18:33:18

Timothy Boronczyk has posted about an interesting concept you could use in your applications - currying (made possible in PHP 5.3.x and above):

What happens if you don't have all the arguments handy for a function, but you want to give whatever arguments you do have now and then provide the rest of them to the function later? This is called currying, and is a core concept in functional programming. It's messy, but possible to curry functions in PHP now that closures have been added.

He starts with an example from OCaml/F# to illustrate the point and moves to a PHP example - changing a normal function that requires three parameters into one that makes it possible to only submit the parameters you'd want to use. He also includes a more "real life" example of how it could be used in array filtering.

tagged: usecase tutorial closures currying

Link:

PHPClasses.org:
Upcoming PHP 5.3 features and beyond
Apr 28, 2009 @ 12:56:34

This new post to the PHPClasses.org blog take a look at some of the new features that will be included in the PHP 5.3 release (coming soon to a web server near you!) by way of an interview with Lukas Smith.

his article presents an interview with core PHP developer Lukas Kahwe Smith that has pushed many of the new features of PHP 5.3 as release manager. Lukas talks about PHP 5.3 new features such as lambda functions, closures and PHAR support. He also explains what are traits, which for now it is a feature that was left out of PHP 5.3. He also talks about future PHP 5.x and PHP 6, as well how anybody can help in the development of PHP to make it come out faster.

They talk about the PHP.net wiki, briefly touch on the PHP 5.3 feature updates, performance/memory usage in the new version, Lambda functions, closures and PHAR and what's to come with PHP 6.

tagged: lukassmith php5 upcoming php6 interview phar closures lambda memory usage

Link:

Community News:
PHP 5.3beta1 Announced
Jan 29, 2009 @ 13:56:05

The first step towards a full, stable release of the next version of PHP - 5.3 - has officially been made - the first beta (PHP 5.3beta1) has been released and is now available for download.

The biggest change is dropping of OO functionality in closures as full OO support for closures is planed for a later release than PHP 5.3.0. See http://wiki.php.net/rfc/closures/removal-of-this. This release marks the begin of a feature freeze and bug fix only phase. If in doubt whether your change is a bugfix please run it by Lukas and me.

You can download the packages here:

tagged: php5 beta download release object oriented closures feature freeze

Link:

Mark Brady's Blog:
Closures in PHP 5.3
Oct 01, 2008 @ 13:47:50

Mark Brady has a recent post he's worked up that looks at a feature in the upcoming PHP 5.3 version - closures.

According to object-oriented programming expert Martin Fowler, closures are defined as a block of code that can be passed to a function. [...] PHP's upcoming syntax for closures is shaping up to be comparable to the C# 2.0 implementation.

He includes two code examples to compare the two language's methods - one for C# and the other for PHP - that divides the input by a denominator and returns a true or false depending on the result. For more information on closures, see this proposal on the PHP.net wiki.

tagged: closures php5 example c# compare

Link:

PHP.net:
PHP 5.3 alpha 1 Released
Aug 01, 2008 @ 12:58:29

As announced on the PHP.net site today, the first alpha version of the much-anticipated PHP 5.3 has been released - PHP 5.3 alpha 1.

The PHP development team is proud to announce the first alpha release (Windows binaries will appear in the next few days) of the upcoming minor version update of PHP. The new version PHP 5.3 is expected to improve stability and performance as well as add new language syntax and extensions. Several new features have already been documented in the official documentation, others are listed on the wiki in preparation of getting documented. Please also review the NEWS file.

Among the list of new features/improvements are things like namespaces, late static binding, lambda functions, closures, support for mysqlnd and removal of support for pre-Windows 2000 systems. For more information on when the full stable version will his the web, check out the release plan.

tagged: php5 release alpha preview namespace latestaticbinding lambda closures

Link:

LivePipe Blog:
What PHP6 Actually Needs
May 15, 2007 @ 15:13:00

On the LivePipe blog, there's a whishlist that Ryan has posted for some of the things he'd like to see in PHP6.

His list consists of:

  • Closures
  • { } is the new array()
  • Parameter Collection in Functions
  • Late Static Binding
  • Backwards Compatibility

Each is explained, some with code to illustrate.

tagged: php6 need wishlist closures array parameter static binding php6 need wishlist closures array parameter static binding

Link:

LivePipe Blog:
What PHP6 Actually Needs
May 15, 2007 @ 15:13:00

On the LivePipe blog, there's a whishlist that Ryan has posted for some of the things he'd like to see in PHP6.

His list consists of:

  • Closures
  • { } is the new array()
  • Parameter Collection in Functions
  • Late Static Binding
  • Backwards Compatibility

Each is explained, some with code to illustrate.

tagged: php6 need wishlist closures array parameter static binding php6 need wishlist closures array parameter static binding

Link:

Dikini.net:
Some ways to use saved state with closures in PHP
Jan 25, 2006 @ 18:43:20

On dikini.net today, there's a new post that talks about a method of implementing saved state in PHP, and how to couple it with closures.

In a previous short post I describe a way to emulate closures in php. Using that technique execution environment, otherwise known as a call stack can be saved for future use. This can be put to good use. A couple of patterns or programming techniques could be useful in practice.

A closure represents a state => implemenation of a state pattern. This is a bit rich. Usually in OO programming the state pattern is implemented by encapsulating different protocols, for denoted states. This is simple to implement by substituting your protocol specification with a different name.

His example starts off with the Drupal hooks, using the State pattern to create a method of tracking "where we are" via PHP.

tagged: saved state closures emulation call stack saved state closures emulation call stack

Link:

Dikini.net:
Some ways to use saved state with closures in PHP
Jan 25, 2006 @ 18:43:20

On dikini.net today, there's a new post that talks about a method of implementing saved state in PHP, and how to couple it with closures.

In a previous short post I describe a way to emulate closures in php. Using that technique execution environment, otherwise known as a call stack can be saved for future use. This can be put to good use. A couple of patterns or programming techniques could be useful in practice.

A closure represents a state => implemenation of a state pattern. This is a bit rich. Usually in OO programming the state pattern is implemented by encapsulating different protocols, for denoted states. This is simple to implement by substituting your protocol specification with a different name.

His example starts off with the Drupal hooks, using the State pattern to create a method of tracking "where we are" via PHP.

tagged: saved state closures emulation call stack saved state closures emulation call stack

Link:


Trending Topics: