Guest Posted June 15, 2011 Share Posted June 15, 2011 I think this is probably simple but cannot find it looking for or on google isnt the best lol but how can I make my own function do somthing or die? I want my function to work like this myfunction() or die("nope didnt work"); Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/ Share on other sites More sharing options...
.josh Posted June 16, 2011 Share Posted June 16, 2011 that will work, as long as myfunction() returns something evaluated as false Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/#findComment-1230250 Share on other sites More sharing options...
Guest Posted June 16, 2011 Share Posted June 16, 2011 Oh ok thank you i didnt know it was that simple i was thinking i had to throw something. Thank you Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/#findComment-1230257 Share on other sites More sharing options...
.josh Posted June 16, 2011 Share Posted June 16, 2011 FYI there are way better ways of doing custom error handling. Overall I would not recommend doing that ..or die() thing. Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/#findComment-1230258 Share on other sites More sharing options...
fugix Posted June 16, 2011 Share Posted June 16, 2011 the only time i would suggest using the die() function is when you are in the debugging stage, when your site is live using die() is impractical, not very user friendly Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/#findComment-1230289 Share on other sites More sharing options...
Guest Posted June 16, 2011 Share Posted June 16, 2011 Yea I have an error function i call and it displays a error page that looks nicer and it sends me a message to let me know an error occurred. I just wanted to create some functions that other people can use and work on different parts of code and my code could send false back to let their code error out and I didnt know it was so simple. Quote Link to comment https://forums.phpfreaks.com/topic/239484-my-own-or-die/#findComment-1230300 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.