Created
September 11, 2013 17:14
-
-
Save philwinkle/6526768 to your computer and use it in GitHub Desktop.
Closures and Mage::register
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
#file: closures.php | |
require('app/Mage.php'); | |
Mage::app(); | |
//testing Mage::registry closure support | |
Mage::register('testing',function($v){ | |
return "hello $v world"; | |
}); | |
//fetch and exec | |
$func = Mage::registry('testing'); | |
echo $func(); | |
//=>"hello world"; | |
echo $func('philwinkle'); | |
//=>"hello philwinkle world"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment