php[world] 2017

Voting

Please answer this simple SPAM challenge: one minus zero?
(Example: nine)

The Note You're Voting On

sander at rotorsolutions dot nl
4 years ago
Just an example why finally blocks are usefull (5.5)

<?php

//without catch
function example() {
  try {
   
//do something that throws an exeption
 
}
  finally {
   
//this code will be executed even when the exception is executed
 
}
}

function
example2() {
  try {
    
//open sql connection check user as example
    
if(condition) {
        return
false;
     }
  }
  finally {
   
//close the sql connection, this will be executed even if the return is called.
 
}
}

?>

<< Back to user notes page

To Top