<?php
function throwIfTrue($param) {
try {
if ($param)
throw new Exception("test exception");
}
catch (Exception $e) {
echo "catch ";
}
finally {
echo "finally", "\n";
}
}
ThrowIfTrue(true);
//печатается: "catch" и "finally"
ThrowIfTrue(false);
//печатается только "finally"