{% else-1 %}
BB код для подсветки SQL кода

                        
<?php
function sql($sql){
$s = preg_replace('/\CREATE/isU','<span style="color: blue; font-weight:bold;">CREATE</span>', $sql);
$s = preg_replace('/\TABLE /isU','<span style="color: blue; font-weight:bold;">TABLE </span>', $s);
$s = preg_replace('/INTO/isU','<span style="color: blue; font-weight:bold;">INTO</span>', $s);
$s = preg_replace('/\ INT/isU','<span style="color: #00774f; "> INT </span>', $s);
$s = preg_replace('/\`(.*)`/isU','<span style="color: #212c28; "> `$1` </span>', $s);
$s = preg_replace('/\ NOT/isU','<span style="color: #3192a3; "> NOT </span>', $s);
$s = preg_replace('/\ NULL/isU','<span style="color: #1f4f85; "> NULL </span>', $s);
$s = preg_replace('/\,/isU','<span style="color: #212c28; font-weight:bold;">,</span>', $s);
$s = preg_replace('/\VARCHAR(([0-9]*))/isU','<span style="color: #5257a5; font-weight:bold;">VARCHAR$1</span>', $s);
$s = preg_replace('/\TEXT/isU','<span style="color: #5257a5; font-weight:bold;">TEXT</span>', $s);
$s = preg_replace('/\TINYINT/isU','<span style="color: #5257a5; font-weight:bold;">TINYINT</span>', $s);
$s = preg_replace('/\SMALLINT/isU','<span style="color: #5257a5; font-weight:bold;">SMALLINT</span>', $s);
$s = preg_replace('/\MEDIUMINT/isU','<span style="color: #5257a5; font-weight:bold;">MEDIUMINT</span>', $s);
$s = preg_replace('/\BIGINT/isU','<span style="color: #5257a5; font-weight:bold;">BIGINT</span>', $s);
$s = preg_replace('/\FLOAT/isU','<span style="color: #5257a5; font-weight:bold;">FLOAT</span>', $s);
$s = preg_replace('/\DOUBLE/isU','<span style="color: #5257a5; font-weight:bold;">DOUBLE</span>', $s);
$s = preg_replace('/\REAL/isU','<span style="color: #5257a5; font-weight:bold;">REAL</span>', $s);
$s = preg_replace('/\DECIMAL/isU','<span style="color: #5257a5; font-weight:bold;">DECIMAL</span>', $s);
$s = preg_replace('/\(/isU','<span style="color: #000000; font-weight:bold;">(</span>', $s);
$s = preg_replace('/\)/isU','<span style="color: #000000; font-weight:bold;">)</span>', $s);
$s = preg_replace('/\ NUMERIC/isU','<span style="color: #5257a5; font-weight:bold;">NUMERIC</span>', $s);
$s = preg_replace('/\TINYTEXT/isU','<span style="color: #5257a5; font-weight:bold;">TINYTEXT</span>', $s);
$s = preg_replace('/\MEDIUMTEXT/isU','<span style="color: #5257a5; font-weight:bold;">MEDIUMTEXT</span>', $s);
$s = preg_replace('/\ LONGTEXT/isU','<span style="color: #5257a5; font-weight:bold;">LONGTEXT</span>', $s);
$s = preg_replace('/\TINYBLOB/isU','<span style="color: #5257a5; font-weight:bold;">TINYBLOB</span>', $s);
$s = preg_replace('/\BLOB/isU','<span style="color: #5257a5; font-weight:bold;">BLOB</span>', $s);
$s = preg_replace('/\MEDIUMBLOB/isU','<span style="color: #5257a5; font-weight:bold;">MEDIUMBLOB</span>', $s);
$s = preg_replace('/\ LONGBLOB/isU','<span style="color: #5257a5; font-weight:bold;">LONGBLOB</span>', $s);
$s = preg_replace('/\ DATE/isU','<span style="color: #5257a5; font-weight:bold;">DATE</span>', $s);
$s = preg_replace('/\TIME/isU','<span style="color: #5257a5; font-weight:bold;">TIME</span>', $s);
$s = preg_replace('/\TIMESTAMP/isU','<span style="color: #5257a5; font-weight:bold;">TIMESTAMP</span>', $s);
$s = preg_replace('/\DATETIME/isU','<span style="color: #5257a5; font-weight:bold;">DATETIME</span>', $s);
$s = preg_replace('/\ enum/isU','<span style="color: #5257a5; font-weight:bold;">enum</span>', $s);
$s = preg_replace('/\INSERT/isU','<span style="color: blue; font-weight:bold;">INSERT</span>', $s);
$s = preg_replace('/\VALUES/isU','<span style="color: blue; font-weight:bold;">VALUES</span>', $s);
$s = preg_replace('/\DROP/isU','<span style="color: blue; font-weight:bold;">DROP</span>', $s);
$s = preg_replace('/\DEFAULT/isU','<span style="color: blue; font-weight:bold;">DEFAULT</span>', $s);
$s = preg_replace('/ENGINE/isU','<span style="color: #3cbfce; font-weight:bold;">ENGINE</span>', $s);
$s = preg_replace('/MyISAM/isU','<span style="color: #3cbfce; font-weight:bold;">MyISAM</span>', $s);
$s = preg_replace('/CHARSET/isU','<span style="color: #3cbfce; font-weight:bold;">CHARSET</span>', $s);
$s = preg_replace('/AUTO_INCREMENT/isU','<span style="color: blue; font-weight:bold;">AUTO_INCREMENT</span>', $s);
$s = preg_replace("/'(.*)'/isU","<span style='color: #a8bbbd; font-weight:bold;'>'$1'</span>", $s);
return $s;
}
?>

Пример испольхования
<?php
echo sql("INSERT INTO `gg` (`id`) VALUES ('1')");
?>
-1 36 0
Без комментариев...