<?php
function throwIfTrue($param) {
try {
if ($param)
throw new Exception("test exception");
}
catch (Exception $e) {
echo "catch ";
}
finally {
echo "finally", "\n";
}
}
ThrowIfTrue(true);
//printed: "catch" and "finally"
ThrowIfTrue(false);
//printed only "finally"