Return to Snippet

Revision: 39174
at January 14, 2011 05:12 by letanure


Initial Code
function test($var, $lang = 'php', $apenas_var = true, $die = true){
	    if($apenas_var)
		ob_clean();
	    echo '<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>';
	    echo '<script type="text/javascript" src="http://github.com/balupton/jquery-syntaxhighlighter/raw/master/scripts/jquery.syntaxhighlighter.min.js"></script>';
	    echo '<script type="text/javascript">$.SyntaxHighlighter.init();</script>';
	    echo '';
	    echo '<code id="printR" class="language-'.$lang.'" style="margin:50px 10%; width:80%;">';
	    if($lang == 'html')
		echo htmlentities($var);
	    else
		print_r($var);
	    echo '</code>';
	    if($die){
		ob_flush();
		ob_end_clean();
		die('end');
	    }
	}

Initial URL

                                

Initial Description
alternative to print_r with syntax highlight using jquery

Initial Title
alternative to print_r with syntax highlight

Initial Tags
php

Initial Language
PHP