Skip to content

Instantly share code, notes, and snippets.

View eldinphp's full-sized avatar
🏠
Working from home

Eldin Egrlić eldinphp

🏠
Working from home
  • Bosnia and Herzegovina
View GitHub Profile
@eldinphp
eldinphp / render-php-file.php
Created December 21, 2018 08:41 — forked from james2doyle/render-php-file.php
A function to render a php file with data. Allows templating and then sending an array of data into the view.
function render($filename, $vars = null) {
ob_start();
if (!empty($vars)) {
extract($vars);
}
include $filename;
return ob_get_clean();
}