PHP 7.2.0 Beta 1 Released

Voting

Please answer this simple SPAM challenge: five minus four?
(Example: nine)

The Note You're Voting On

jenshausdorf at gmail dot com
16 days ago
Please don't do something like this:

<?php
try {
   
// experimental stuff to check whether something works
} catch(\Throwable $e) {
    return
false;
}
finally {
    return
true;
}
?>

Well, it is allowed syntax, it is bad practice, because once it hits the exception block, finally won't be called(because it exits the scope). Finally was invented to prevent duplicated code after one operation, regardless whether it was successful(for example closing the connection to a server). This way, you don't have any duplicated code. So you don't need to use this structure.

<< Back to user notes page

To Top