Is there any way to show, or throw, a PHP warning?

Viewed 35328

I have a select() method in a database class, that has an optional boolean argument $sum. This argument is used to say if the method should use COUNT(*) or not too.

I would like to show a warning, like those normal PHP errors, if I try to access $class->sum if the attribute is not set (i.e. when I call select() with $sum == false.

Is there any way to show a warning like this, or I should just echo an error and be happy?

3 Answers

You're going the object-oriented approach, so I suggest a look into exceptions.

Related