<? ob_start(); ... //some html,js,php $contentus = ob_get_contents(); ob_clean(); echo some_function($contentus); ?>