jordanwb Posted March 19, 2009 Share Posted March 19, 2009 I know what the try and catch blocks do but what does the finally block do? Link to comment https://forums.phpfreaks.com/topic/150086-try-catch-finally/ Share on other sites More sharing options...
markjoe Posted March 19, 2009 Share Posted March 19, 2009 I have never used exceptions in PHP, but the finally block should execute whether or not the was an exception thrown or caught. try{ // code that might throw exception }catch{ // code will that will run ONLY if exception is thrown }finally{ // code that will always run // unless you exit() or die() in the catch, i think } Link to comment https://forums.phpfreaks.com/topic/150086-try-catch-finally/#findComment-788235 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.