Is it bad to echo things directly from a class? Like for a class that holds errors, is it bad to echo the customer errors in the class or should it be done with the variable that holds the object? for example:
ex 1:
class MyClass
{
function db_error()
{
$message = 'yo';
echo $message;
}
}
$var = new MyClass;
$var->db_error();
ex 2:
class MyClass
{
function db_error()
{
$message = 'yo';
}
}
$var = new MyClass;
Which method is better? If method 2, how am I supposed to echo a variable from a function in a class, $var->db_error()->message wont work...