Skip to content

Instantly share code, notes, and snippets.

@thomasRag
Created January 12, 2017 03:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasRag/570daec9b153c0c0307e9310b1dd71a9 to your computer and use it in GitHub Desktop.
Save thomasRag/570daec9b153c0c0307e9310b1dd71a9 to your computer and use it in GitHub Desktop.
<?php
$compose = function($f, $g){
return function($x) use ($f,$g) {
return $f($g($x));
};
};
$toUpperCase = function($x) {
return strtoupper($x);
};
$exclaim = function($x) {
return $x . '!';
};
$shout = $compose($exclaim, $toUpperCase);
echo $shout("send in the clowns");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment