Expert web application development services. 

Specializing in customized web applications developed in PHP. 

Contact Marion Consulting for your web development needs.

Home arrow PHP
PHP
Intentionally throw PHP errors PDF Print E-mail
Written by Marion Consulting   

Error messages are not something that most developers enjoy seeing, but they can be very useful especially when debugging or testing an applications code.  Sometimes we would like throw an error to see how the application behaves and below is an example of how to do just this.

trigger_error

Generates a user-level error/warning/notice message (PHP 4 >= 4.0.1, PHP 5)

bool trigger_error ( string error_msg [, int error_type] )
 

 

error_msg

The designated error message for this error. It's limited to 1024 characters in length. Any additional characters beyond 1024 will be truncated.

error_type

The designated error type for this error. It only works with the E_USER family of constants, and will default to E_USER_NOTICE.

Example usage: trigger_error ('I just threw an error", E_USER_ERROR); 
<< Start < Prev 1 2 Next > End >>

Results 1 - 1 of 2
(C) 2010 Marion Consulting - Expert PHP/MYSQL/Smarty consulting services. PHP/MySQL developer Experienced Web developer LAMP (PHP, MySQL) Programmer