<?php
#модуль проверки и вывода ошибок. Давно мечтал это написать...
function error_start($string='error')
{
GLOBAL $error_string;
$error_string[$string]=array();
return $string;
}
function error_add($text='Ошибка!',$string='error')
{
GLOBAL $error_string;
$error_string[$string][]=$text;
return true;
}
function error_check($string='error')
{
GLOBAL $error_string;
$num=count($error_string[$string]);
if($num) return true;
else return false;
}
function error_echo($color='red',$string='error')
{
GLOBAL $error_string;
if(count($error_string[$string]))
{
echo '<p><span style="color: '.$color.';">';
foreach($error_string[$string] as $value)
{
echo $value.'<br />';
}
echo '</span></p>';
}
else return false;
}
function error_destroy($string='error')
{
GLOBAL $error_string;
unset($error_string[$string]);
return true;
}
?>