Skip to content

Instantly share code, notes, and snippets.

@mbunge
Created June 13, 2012 16:23
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 mbunge/2925070 to your computer and use it in GitHub Desktop.
Save mbunge/2925070 to your computer and use it in GitHub Desktop.
Anonymus Function Test
<?php
$stdClass = new stdClass();
$stdClass->value = 'HELLO WOLRD';
//return message defined by $stdClass::value with a context
//use $stdClass as scope
$lambda = function($context) use ($stdClass)
{
$msg = $context . ': ' . $stdClass->value;
return $msg;
};
echo $lambda('TEXT');
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment