Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP Error

DZone's Guide to

PHP Error

·
Free Resource
Error handling is an important part of creating web applications and espesially in drupal development. There are three different error handling methods: 

        * Simple "die()" statements
        * Custom errors and error triggers
        * Error reporting

    It’s quite simple to create a custom error handler. Just create a special function that can be called when an error occurs in PHP. 
 

error_function(error_level,error_message,
 
error_file,error_line,error_context)

A function to handle errors is shown below:

function customError($errno, $errstr)
 
  {
 
  echo "Error: [$errno] $errstr
"; echo "Ending Script"; die(); }
Topics:

Opinions expressed by DZone contributors are their own.

The best of DZone straight to your inbox.

SEE AN EXAMPLE
Please provide a valid email address.

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.
Subscribe

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}