function write_log data if DEBUG log date foreach data as val if empty

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
function write_log ($data)
{
if(DEBUG)
{
$log = date("d.m.Y H:i:s");
foreach ($data as $val)
{
if(empty($val))
continue;
if(is_array($val))
{
write_log(array('FUNCTION_ERROR', 'write_log Multi Array'));
$log .= ' # '.strip_tags(preg_replace('|\n|', ' ', print_r($val, true)));
}
else
$log .= ' # '.strip_tags($val);
}
@error_log ($log.PHP_EOL,3,'logs.log');
}
}