Created
March 15, 2009 23:10
-
-
Save speedmax/79577 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function evaluate_block($block, $arguments = array()) { | |
# implict return | |
$lines = explode(';', $block); | |
$last =& $lines[count($lines)-2]; | |
if (strpos($last, 'return') === false) { | |
$last = 'return '.$last; | |
} | |
$block = join(';', $lines); | |
if (isset($arguments['this'])) { | |
$arguments['self'] = $arguments['this']; | |
unset($arguments['this']); | |
} | |
unset($arguments['block']); | |
extract($arguments); | |
return eval($block); | |
} |
This file contains hidden or 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
echo "***INJECT***\n"; | |
print_r($e->inject(array(), '#| $object, $key, $value | | |
$object["injected_$key"] = $value; | |
$object; | |
')); | |
$e->map('$object->id;'); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment