I wanna buffer some content. The way how the content is fetched depends, that's why I added a type parameter to my buffer function to define whether to include or to echo the source.
PHP
<?php
function bufferContent($source, $type = 'include') {
ob_start();
$type($source);
return ob_get_clean();
}
echo bufferContent('<html>test</html>', 'echo');
?>
Output
Fatal error: Call to undefined function echo() in #### on line 5
Why's that? Isn't it possible to call a standard PHP function like echo() or include() by a string variable?
Edit: Changed question slightly to make it more suitable to the answers.