basic-php-09-snippet04.php / php
<?php //create your error handler function function handler(error_message, error_line) { echo "<h1>Page Error</h1>"; echo "Errors have occurred while executing this page. Contact the "; echo "<a href=\"mailto:admin@yourdomain.com\">;administrator</a> " . "to report errors<br><br>"; echo "<b>Information Generated</b><br><br>"; echo "<b>Error Type:</b> <br>"; echo "<b>Error Message:</b> error_message<br>"; echo "<b>Error Filename:</b> <br>"; echo "<b>Error Line:</b> error_line"; } //set the error handler to be used set_error_handler("handler"); //set string with "Wrox" spelled wrong //try to use str_replace to replace Worx with Wrox //this will generate an E_WARNING //because of wrong parameter count str_replace("Worx", "Wrox"); ?>
(C) Æliens 20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.