Skip to content

Instantly share code, notes, and snippets.

View ayarse's full-sized avatar

ayaz ayarse

View GitHub Profile
@ayarse
ayarse / Capture.php
Last active August 29, 2015 14:21
Function that forces functions to return instead of echoing output
<?php
function capture($callback)
{
$args = func_get_args();
array_shift($args);
ob_start();
if (count($args))
call_user_func_array($callback, $args);
else
call_user_func($callback);