Mido Posted July 29, 2010 Share Posted July 29, 2010 Hello It's about exception handling... I have two if statements, one inside the other. And I want to throw an exception from each, if one of them is FALSE. What "technique" should I use? I think throwing same exception with the same message within two if's is a bit messy. like: if $x is true //go to 2nd if: if $y is true return value if $y is false: throw exception "Invalid number" if $x is false: throw exception "Invalid number" Thanks, Link to comment https://forums.phpfreaks.com/topic/209267-throwing-2-exceptions-with-the-same-message-in-2-different-places/ Share on other sites More sharing options...
Mido Posted July 29, 2010 Author Share Posted July 29, 2010 I thought about adding throw-statement after the two if statements. Would that do it? Link to comment https://forums.phpfreaks.com/topic/209267-throwing-2-exceptions-with-the-same-message-in-2-different-places/#findComment-1092760 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.