fork download
  1. <?php
  2.  
  3. class Test {
  4. public function getSomeData() {
  5. throw new Exception('something went wrong');
  6. }
  7. }
  8.  
  9. try {
  10. $data = (new Test)->getSomeData();
  11. }
  12. catch(Exception $e) {
  13. echo $e->getMessage();
  14. }
Success #stdin #stdout 0.01s 52488KB
stdin
Standard input is empty
stdout
something went wrong