function colorize($text, $status)
{
$out = "";
switch ($status) {
case "SUCCESS":
case "Green":
$out = "[32m"; //Green
break;
case "FAILURE":
case "Red":
$out = "[31m"; //Red
break;
case "WARNING":
case "Yellow":
$out = "[33m"; //Yellow
break;
case "NOTE":
case "Blue":
$out = "[34m"; //Blue
break;
default:
throw new Exception("Invalid status: " . $status);
}
return chr(27) . "$out" . "$text" . chr(27) . "[0m";
}
echo colorize("table updating complete.\n","Green");
echo colorize("table err. \n","Red");