Jump to content

Custom Error Message


The Little Guy

Recommended Posts

I have a method, where I want the first value to be an array, if the value isn't an array that is added, how can I alert them?

 

For example if I pass a string to the parameters for array_merge, I get an error:

 

Warning: array_merge() [function.array-merge]: Argument #1 is not an array in /home/ryannaddy/ryannaddy.com/BotStop/examples/mailbot.php on line 29

 

So say I have this index.php:

$mail->mail('cat', 'dog');  // Line 12

 

then in the class I have this MyClass.php:

public function mail($v1, v2){  // Line 211
    if(!is_array($v1)){
        // trigger some sort of error saying that they Argument #1 is not an array in index.php on line 12
    }
}

 

if you read my comments in the above two it will make some sense. Any way how can I get a message like that to occur?

Link to comment
https://forums.phpfreaks.com/topic/205973-custom-error-message/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.