Tag Archives: php-errors

Why are PHP errors printed twice?

Summary Amazingly I could find nothing about this on Google or SO. When I throw an exception in PHP it appears in my console twice, complete with error message and stack trace. The first time it’s printed it says “PHP… Continue reading
Tagged , , | Leave a comment

PHP Error handling: die() Vs trigger_error() Vs throw Exception

In regards to Error handling in PHP — As far I know there are 3styles die()or exit() style:
$con = mysql_connect("localhost","root","password");

if (!$con) {
 die('Could not connect: ' . mysql_error());
}
throw Exception style:
 if (!function_exists('curl_init')) {

      throw
Continue reading
Tagged , , , | Leave a comment

When should I throw an exception as opposed to return an error in PHP?

I’m working on an API wrapper class, which is the first I’ve made. For the most part it hasn’t been too difficult. Getting to the point where I need to deal with the potential of errors being returned by the… Continue reading
Tagged , , , , | Leave a comment

How do I store an php object in a MySQL table?

I have set up a table that has only one field for a BLOB (Binary large object) but when I try to Insert it into the table it throws an error stating that it failed to convert the object to… Continue reading
Tagged , , , | Leave a comment
1 pages