News Feed
Sections




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

Sameer Borate's Blog:
Functional programming with Underscore.php
September 13, 2011 @ 08:53:49

In a new post to his blog Sameer Borate looks at using the Underscore.php library to do a little functional programming in PHP. Underscrore.phpis a PHP port of Underscrore.js.

Underscore.php provides a utility library for PHP that provides a lot of the functional programming support that a programmer would expect in Ruby, but without adding much overhead during execution. The only caveat is that underscore.php requires PHP 5.3 or greater. Although you could accomplish some of the things using PHP's built in functions, the functional approach looks intuitive and easy to work with.

He gives a few simple code examples - one using the "pluck" method to pull certain values out of an array, the "map" method to apply a transformation to each item in an array and some OOP examples showing the use of the "max" and "template" methods.

0 comments voice your opinion now!
tutorial underscore functional programming


blog comments powered by Disqus

Similar Posts

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 11)

Deepak Radhakrishnan\'s Blog: Configuring Apache - PHP - MySQL on Windows (WAMP Configuration)

Anthony Ferrara: What Generators Can Do For You

Jani Hartikainen's Blog: Zend_Acl part 2: different roles and resources, more on access

Chris Shiflett's Blog: PHP Session Debugging


Community Events





Don't see your event here?
Let us know!


community developer release symfony list tips introduction api deployment language framework series podcast voicesoftheelephpant conference laravel bugfix interview library zendserver

All content copyright, 2014 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework