steviez Posted June 30, 2008 Share Posted June 30, 2008 Hi, I want to creat a class/function so that i can show errors like this: <?php echo $error->showError['My error here']; ?> How would i do it? Link to comment https://forums.phpfreaks.com/topic/112626-help-with-class/ Share on other sites More sharing options...
craygo Posted June 30, 2008 Share Posted June 30, 2008 Not sure if you need an entire class for just errors. Usually the errors are in an existing class. For instance if you have a class for mysql functions, then you would put the error checking right in the class. but to answer your question error.class.php <?php class error_check{ function showError($msg){ $message = $msg; return $message; } } ?> then include file on page <?php include ('error.class.php'); $error = new error_check(); echo $error->showError("my error here"); ?> Ray Link to comment https://forums.phpfreaks.com/topic/112626-help-with-class/#findComment-578418 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.