The Little Guy Posted June 27, 2010 Share Posted June 27, 2010 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? Quote Link to comment Share on other sites More sharing options...
Alex Posted June 27, 2010 Share Posted June 27, 2010 You can debug_backtrace to tell what line in what file the current function being executed was called from. Quote Link to comment Share on other sites More sharing options...
The Little Guy Posted June 27, 2010 Author Share Posted June 27, 2010 hip hip hooray! Thank you! Works perfect! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.