Last active
August 29, 2015 14:01
-
-
Save dhrrgn/1480e6ad90ac394e43eb 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
<?php | |
function require_in_context($__path, array $__context) | |
{ | |
extract($__context, EXTR_SKIP); | |
unset($__context); | |
ob_start(); | |
require $__path; | |
return ob_get_clean(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Be sure to add EXTR_SKIP to
extract
to prevent it from overwriting the$__path
variable.