http://rosettacode.org/wiki/Function_compositionfunction compose($f, $g) { return function($x) use ($f, $g) { return $f($g($x)); };} $trim_strlen = compose('sqrt', 'strlen');echo $result = $trim_strlen('Test'), "n"; // prints 2http://wafe.github.io/php-the-right-way/pages/Functional-Programming.htmlPHP5.3 이상에서는 함수를 인자 형태로 넘기는 게 가능하다.
댓글 달기