0

I am quite new to OOP and classes. One thing I am struggling with is that if there are errors within a method of a class, no error messaging is displayed, the page just breaks. Does anyone know why this is or how I can get this to display errors?

LeeTee
  • 6,401
  • 16
  • 79
  • 139
  • This has nothing to do with OOP or classes, but with error reporting. Take a look at [How to get useful error messages in PHP?](http://stackoverflow.com/questions/845021/how-to-get-useful-error-messages-in-php). – CodeCaster May 21 '12 at 14:47
  • Fatal errors aren't specific to OOP. `ini_set('display_errors', 1)` – Michael Berkowski May 21 '12 at 14:48
  • 4
    -1 because you haven't shown that you've done any research on the topic. This is one of the most commonly asked questions regarding PHP so you should be able to find plenty of answers. – Emil Vikström May 21 '12 at 14:49
  • Are the downvotes due to the fact that he thought that the error messages were related to OOP? If so, I don't think they were deserved. – Levi Hackwith May 21 '12 at 14:49

1 Answers1

1

http://us.php.net/manual/en/function.error-reporting.php

Put this at the top of the page that includes your class.

<?php
error_reporting(E_ALL);
?>
Levi Hackwith
  • 9,232
  • 18
  • 64
  • 115
  • 1
    Id originally added this error reporting inside the class and not inside the page that includes the class. I have moved it and it seems to be working. Thanks. – LeeTee May 21 '12 at 15:03